function [socketHandles,packetNum] = warplab_initialize(varargin) warplab_defines; % Create arp entry for magic sync %!arp -s 10.0.0.255 ff-ff-ff-ff-ff-ff 10.0.0.200 %Close any stale sockets before trying to create new ones pnet('closeall'); % Check length of input argument leninput = length(varargin); % Input argument varargin defines the number of nodes if(0 == leninput) % If there is no number of nodes specified then use 2 nodes as default nodes = [1:2]; else % If there is a number of nodes specified then use that many number of % nodes nodes = [1:1:varargin{1}]; end %Define the nodes' IP addresses & UDP ports % The IP address and UDP port ranges must match those hardc-coded in the FPGA IPAddrs = warplab_IP2int(strcat(WARP_subnet,'.0')) + nodes; UDP_Ports = NodeStartingPort + nodes-1; %Define an initial packet number packetNum = 1; socketHandles = warplab_initNets(strcat(WARP_subnet,SyncAddr), IPAddrs, UDP_Ports); warplab_initNodes(socketHandles);