Fixed setConn function in MATLAB client

This commit is contained in:
Jason Watkins
2015-03-30 16:36:00 -07:00
parent c37256de51
commit 22cbf903b5
4 changed files with 24 additions and 13 deletions

View File

@@ -1,4 +1,4 @@
function [ data ] = readUDP( input )
function [ data ] = readUDP( varargin )
%readUDP Read Array from UDP Socket
%
% Inputs
@@ -36,9 +36,20 @@ function [ data ] = readUDP( input )
bits = 2000;
%% Interpret Input
socket = input;
if isnumeric(input)
socket=openUDP(input);
global udpReadPort;
if isempty(varargin)
if isempty(udpReadPort)
udpReadPort = 49008;
end
socket = openUDP(udpReadPort);
ownSocket = 1;
else
socket = varargin{1};
ownSocket = 0;
if isnumeric(varargin{1})
socket=openUDP(varargin{1});
ownSocket = 1;
end
end
%% Try reading packet
@@ -65,7 +76,7 @@ function [ data ] = readUDP( input )
end
%% Close Port (if opened in code)
if isnumeric(input)
if ownSocket
socket.close()
end
end