From: Jose on 7 Jul 2010 08:59 Hello to everyone, I need to contruct a timer object with a time delay or an indicator: Main program (slave computer) svrsock = mslisten(3000); % listening to the Master through a socket sock=msaccept(svrsock); msclose(svrsock); s=makesdata; The data s hava a particular structure. tpanel = timer('TimerFcn',@timerFun,'executionmode','fixedrate'); start(tpanel); function timerFun(obj,~) [s,suc]=receivestructure(sock) %receive the structure of data s from the Master. % if suc=0...the transmission is succefull (I get s from the Master). % if suc=-1.the transmission is failured (s=[], not data) sends= process (s) 1 % The variable s is analized in the function process and the result (new conditions) is sent to the Master via socket, to get a new variable s from the Master. end Then: 1. Main function...a) receive s structure form the Master: succefully data suc=0, not data suc=-1. b) if suc=0, send the s structure to a function process. 2. Function process...a) analize de structre s, and send the new conditions to the Master. 3. The new s from the Master is sent to the slave ( main function) with suc=0. The problem is, when I costruct a timer object in the main function, it is running independiently if the variable s has been sent to the Master via socket from the function process. How can I insert a delay parameter, or indicator in my timer object to detect that the variable s has been sent to the Master through the socket in the function process, before get a new data succefully, i.e suc=0, if not, I will get in every iteration s=[], not data, with suc=-1, and my connection is lost. Any help, Thanks in advance, Jose.
|
Pages: 1 Prev: Accessing Level 2 M File S Function Dialog Parameters Next: NNtool box information |