Is there a simple way to spawn a copy of your current MATLAB workspace into a new process/thread?

조회 수: 3 (최근 30일)
If not, is there an unnecessarily complex way to do it? ;)
I've written some code that creates plots from EEG time series data (stored in the workspace). The user navigates between the plots using the keyboard, and this lets them see/compare features between the plots.
The only problem is that it blocks the main thread. Running it in a separate thread would be ideal, but it seems like 'batch' doesn't show plots - and it's slow!
system('matlab') works in creating a new process, but the workspace is empty. It's also quite slow.
Is there a simple way to initialise a new process/thread, with my current workspace, so that I can run the plotting script without blocking execution?
Thanks, ~Chris

채택된 답변

Jan
Jan 2017년 4월 10일
편집: Jan 2017년 4월 10일
What does block the main thread? If you have a bunch of GUIs, the callbacks are processed on demand only. As long as there are no waitfor commands or modal dialogs, nothing is blocked.
A save() command saves all variables in the current workspace to the disk. With load() they can be reloaded in another thread. But I assume, that this indirection is a bad idea. Better create a non-blocking interface.

추가 답변 (1개)

Chris Esposito
Chris Esposito 2017년 4월 18일
Thanks, Jan. I ended up creating a save() and load() sequence together with arguments fed to the system('matlab') call to hack it together, but you are right - a separate GUI would be the better option.

제품

Community Treasure Hunt

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

Start Hunting!

Translated by