Is it possible to evaluate current value of variable in base workspace from GUI w/o using evalin()?
1 次查看(过去 30 天)
显示 更早的评论
I am trying to create a tool that allows an external process to 'peek' into a currently running matlab simulation and inspect current simulation state. To make this minimally impactful, I don't want the simulation thread to have to service such requests, as such, I'd like a seperate thread (like a GUI) to read the data in the base workspace 'on the fly' if you will.
I know this can be done with evalin(), but I also know that this cannot be compiled. I was hoping there might be a really clever way of avoiding evailin(). Looking at things like external programming interfaces to matlab, the matlab engine, etc, but I don't have any experience with any of these.
Anybody have any ideas?
Thanks!
0 个评论
回答(2 个)
Walter Roberson
2011-4-6
There is no provided mechanism to do that, especially if "simulation" is hinting at Simulink.
1 个评论
Walter Roberson
2011-4-6
To expand further: fundamental GUI behaviour such as recognizing mouse movement and clicks is handled by Java, which queues up the events. The response to the events is handled by Matlab in a single main thread that acts as the gate-keeper for all variable access. One cannot get around this using operating system level threads. The Parallel Processing Toolkit copies variables to and from the workers, with one thread acting as the variable synchronizer.
Thus, as far as I can tell, the only way to get access to the base workstation is to interrupt the activity on the main Matlab thread, whether via a GUI event being processed under a number of circumstances (e.g., drawnow()) or via a timer going off.
Jarrod Rivituso
2011-4-7
Not sure if this will help you or not, but Simulink provides run-time objects that you can use to access block data during a simulation. Take a look at the "Listening for Method Execution Events" section and see if you could modify it to your needs.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!