I need to use an object among several functions on a Matlab S-Function. The object is used as a library and it is needed to set the conection with a server, get data from it in each loop and close it at the end of simulation. The use of the object its something like this:
ClassX ObjectX;
[Handle clientID]=ObjectX.setConnection(...);
while(coonection)
[result]=ObjectX.getPosition(Handle ClientID,...);
[result]=ObjectX.getAngle(Handle ClientID,...);
...
end
[result]=ObjectX.CloseConnection(...);
Its not convinient to instance and close the comunication in every loop. So I whant to create the object and set the conection on "function setup(block)
", update data on "function Update(block)
" and close the conection on "function Terminate(block)
" but to do this I need to share the "ObjectX" an "clientID" among the functions.
I hope you can help me.