Clear Filters
Clear Filters

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

1 view (last 30 days)
For example, 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 Program 2. I can turn on and off each one separately.
All programs in Matlab.

Answers (1)

Walter Roberson
Walter Roberson on 1 Apr 2023
WIth relatively new versions of MATLAB, you might be able to take advantage of backgroundPool and parfeval the functions. parfeval() returns a future; you can have callbacks cancel futures.
Note however, that background pools are restricted in the features they can use. There are more features available if you have Parallel Computing Toolbox and use parpool and parfeval (technically a different function than the previously mentioned one)
But either way, background pool or parallel pool, tasks created in this way cannot directly interact with graphics that are visible on the screen. They can create graphics and capture frames in the created graphics, but they cannot themselves display anything visible to the user, and cannot ask the user for input.

Categories

Find more on Parallel Computing in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!