How to make command line free while a program rans?
Mostrar comentarios más antiguos
Imagine, I made a program that contineously executes loop FOR-END (a Watch, for example). I'd like to run another program while the first one is still running. However, the command line >> is busy. How to "free" it?
Of course, this is the problem of parallel computing. I am a newbile in it now. As far as I learned, there are several ways to start parallelization, either ">> pmode start" or ">> pool = parpool(2)". (I have two 'Workers').
Do I follow the right way?
After ">> pmode start" we get two-splitted Window with Lab1 and Lab2. How to submit a job to only one of them?
Looking forward,
Yevgeny
7 comentarios
Stephen23
el 18 de Ag. de 2019
As an alternative, just call your function from a graphics callback function.
Yevgeny Gayev
el 18 de Ag. de 2019
Walter Roberson
el 18 de Ag. de 2019
Imagine, I made a program that contineously executes loop FOR-END (a Watch, for example)
What I would imagine is that it would be better to not use a continuous loop for that purpose, and to instead use a timer() object to invoke the code periodically.
Yevgeny Gayev
el 19 de Ag. de 2019
Ted Shultz
el 28 de Ag. de 2019
One other option is to just start up another instance of matlab.
Yevgeny Gayev
el 29 de Ag. de 2019
"Do you mean to make a GUI-envelope, Stephen?"
I have no idea what a "GUI-envelope" is.
I often use graphics callbacks to run code, thus keeping the command line "free" for me to do other things. Of course this requires writing a small GUI, but that is not very difficult.
"I tried this way, no succes."
As you did not show what you tried it is difficult for us to help you fix it.
"May be, I should use OOP-features in MATLAB?"
I don't see how OOP is related to the topic you are asking about.
Respuesta aceptada
Más respuestas (3)
Jason Ross
el 29 de Ag. de 2019
1 voto
You can use the batch function to send work to a parallel worker and then retrieve the results later. While the batch job is running, the command prompt is freed. If you want to send the job to only one worker you can specify that in the batch command.
1 comentario
Walter Roberson
el 29 de Ag. de 2019
Also I forgot about parfeval()
Chidvi Modala
el 29 de Ag. de 2019
0 votos
To submit a job to only one of the window, pmode is not the best fit. The commands you type at the pmode prompt in the Parallel Command Window are executed on all workers at the same time.
You can refer to following link to get more information
Yevgeny Gayev
el 30 de Ag. de 2019
0 votos
2 comentarios
Yevgeny Gayev
el 17 de Sept. de 2019
Walter Roberson
el 17 de Sept. de 2019
Timers can interrupt the currently executing code at the end of any line of MATLAB code. They do not use a different thread for execution of the MATLAB code. It is not impossible that there is a different thread associated with scheduling them -- that would be an internal detail not exposed to the user.
You cannot set executionmode of a timer that is started. To change the execution mode of a timer, you must stop() the timer.
Categorías
Más información sobre Graphics Performance en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!