Clear Filters
Clear Filters

Is it possible to evaluate current value of variable in base workspace from GUI w/o using evalin()?

2 views (last 30 days)
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!

Answers (2)

Walter Roberson
Walter Roberson on 6 Apr 2011
There is no provided mechanism to do that, especially if "simulation" is hinting at Simulink.
  1 Comment
Walter Roberson
Walter Roberson on 6 Apr 2011
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.

Sign in to comment.


Jarrod Rivituso
Jarrod Rivituso on 7 Apr 2011
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.

Categories

Find more on Programming in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!