function [rmc] = ConnectToRMC()
%This function opens communictations with the RMC75 if not yet open.  
%Stores result in the base workspace for convenience. So the return value from this function or
%rmc in the base workspace can be used interchangeably.

if(ismember('rmc',evalin('base','who')) == 0) 
 ip_addr = '134.89.13.161';
 disp(['RMC Not connected, connecting to ip addr ' ip_addr]);
 srv = actxserver('RMCLink.RMCLinkServer');
 rmc = srv.CreateEthernetLink(2,ip_addr);
 rmc.Connect;   
 assignin('base','rmc',rmc);
else
 rmc = evalin('base','rmc');
end

end