0

I want to use two MATLAB sessions on the same machine to run two different programs. My problem is that at some stage, 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.

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

4 Comments

perhaps you should put a pause(..) in that loop :)
@Amro: Yes, I guess I should. Thanks!
if I have in process # 1: runmyfile1.m; runmyfile2.m; and in process # 2: runmyfile3.m; runmyfile4.m; I want the execution of runmyfile4.m occurs after the onset of the outcome of runmyfile1.m noted runmyfile1.mat
@bzak: In this case, runmyfile1.m should write a file wait.plz right when it's launched. The file wait.plz is deleted by runmyfile1.m as soon as the output runmyfile1.mat has been written. The while-loop in my answer would be executed as the first line of runmyfile4.m.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.