英文:
In Matlab, how can I run 2 separate programs simultaneously, each turned on and off by separate buttons?
问题
For ex., 我有程序1和程序2,当我运行commandPrograms程序时,它会打开两个按钮。一个按钮会打开和关闭程序1,另一个按钮会打开和关闭程序2。我可以使用由commandPrograms打开的按钮分别打开和关闭每个程序(程序1和程序2)。
所有的程序都在Matlab中。
我尝试过使用批处理并行化运行它,但我对此不太熟悉,是初学者。
我如何能够同时运行两个独立的程序,每个程序都可以由不同的按钮打开和关闭?
程序1和2不会互动。不幸的是,我需要在Matlab中完成这个任务。
英文:
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
得分: 1
如果您的程序1和程序2不需要进行通信(它们不相互依赖或不需要彼此的输出),我建议每个按钮启动一个运行每个程序的MATLAB实例。这是一个暂时性的解决方案,如果您提供更多详细信息,我可以更新我的答案。
!matlab.exe -r "cd c:\; try, disp('c:\outdir\my.m'); end; quit"
或者
exeProgram = System.Diagnostics.Process;
exeProgram.StartInfo.Arguments = '-示例参数';
exeProgram.StartInfo.FileName = 'C:\program.exe'; % 完整的文件路径
exeProgram.Start();
英文:
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();
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论