Reputation: 3783
I'm using MATLAB R2014b
. I designed a GUI
that have a loop using parallel computing
. First I will set the number of loops in this GUI
and my program will start. Suppose that I want stop the program in middle of process. I should press CONTROL+C
to stop MATLAB
. I put a button to stop it and call a function in loop but it doesn't work when my program is running. These isn't any respond to this button when my program is running.
How can I solve this problem?
Thanks.
Upvotes: 0
Views: 154
Reputation: 25140
I presume by "parallel computing" you mean that your code is running is running in a parfor
loop. The parfor
loop is a synchronous construct which does not allow any other MATLAB commands to execute. If you wish to allow interactive use via a GUI, you need to use parfeval
instead. This example shows how you can terminate parallel processing early.
One thing to bear in mind when using parfeval
is that each call you make to that is a remote invocation, so you need to divide your problem into "sensible" sized chunks.
Upvotes: 1