In Matlab, how can I run 2 separate programs simultaneously, each turned on and off by separate buttons?

56 Views Asked by At

For ex., I have Program 1 & Program 2, when I run commandPrograms program it will open up two buttons. One button will turn on and off Program 1, and the other button will turn on and off Program 2. I can turn on and off each program (Program 1 & Program 2) separately using the button brought up by the commandPrograms.

All programs in Matlab.

I have tried running it using batch parallelization, but quite unfamiliar and a beginner.

How can I run 2 separate programs simultaneously, each turned on and off by separate buttons?

Programs 1 & 2 do not interact. Unfortunately, I need to do it in Matlab.

1

There are 1 best solutions below

1
Mario Malic On

You will need to share more details about interaction of those three programs.

If your Program 1 and Program 2 do not need to communicate (they are not dependant on each other or do not need their outputs), I would suggest that each button starts an instance of MATLAB that run each Program. This is a scribbly solution, if you share more details, I can update my answer.

!matlab.exe -r "cd c:\; try, disp('c:\outdir\my.m'); end; quit"

or

exeProgram = System.Diagnostics.Process;
exeProgram.StartInfo.Arguments = '-example arguments';
exeProgram.StartInfo.FileName = 'C:\program.exe'; % full file path
exeProgram.Start();