how to run 2 script .m at the same time in matlab?

2 次查看(过去 30 天)
I want to run to execute 2 matlab script multiObject1.m and multiObject.m at the same time

采纳的回答

Walter Roberson
Walter Roberson 2015-12-1
编辑:Walter Roberson 2015-12-1
Well, if you really need to do that (the cases are fewer than one might expect) then you will need to use the Parallel Processing Toolbox, and use either parfor or spmd. If the two will need to communicate with each other than spmd would be recommended.
However, when people say they need to run two scripts at the same time, they often mean that one script has to be able to gain control temporarily, do a bit of work, and then allow the other script to continue. It is not uncommon to be able to program that with callbacks of various kinds of events without needing the Parallel Processing Toolbox.
  7 个评论
Guillaume
Guillaume 2015-12-1
No, it will not work. As Walter said, only one script at a time can update what is shown on screen.
To do what you want you'll need to have:
  • main code (script) in charge of displaying both processed video frames at the same time
  • 1st background script in charge of processing the video from one angle. Has to communicate with main code to give it the processed frame when done
  • 2nd background script in charge of processing the video from the 2nd angle. Also has to communicate with main code to give it the processed frame when done
If you don't have the parallel toolbox, then the background scripts would have to be called sequentially on each video frame and display may be far from real time.

请先登录,再进行评论。

更多回答(0 个)

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by