Function to ask a MATLAB program to wait for an event before continuing execution
I want to use two MATLAB sessions on the same machine to run two different programs. My problem is that at some st开发者_Go百科age, the first program must use some results of the second program. So, is there a function that may apply to the first program to expect a step up the appearance of a result.
The easiest way to solve this is to have process #1 create a file in a place accessible by both process #1 and process #2. Process #1 runs until it gets to the point where it needs the results from process #2. At this point, it goes into a loop while exist(myFileName),pause(1),end
, which makes it wait as long as the file exists, checking every second for whether the file's gone. Process #2 removes the file as soon as it's done writing out the results, at which point process #1 continues.
精彩评论