Pass GUI variables to base workspace in real-time

HI all!
I'm building a GUI for automated measurements in our lab and when started I want some variables to be passed from the GUI to the base workspace in real-time for instant pre-analysis.
I’ve tried assignin() but for some reason nothing is passed to the base workspace until the test sequence is over or the test is stopped.
The GUI contains several loops and functions, and I want the variables to be updated at every iteration. How to do this?
To only use disp() or similar is not an option. I want the most recent variable content in the base workspace.
Thank you in advance!
/Jens

댓글 수: 7

I'm curious about the reason assignin() can't work...
How are you detecting that nothing is being passed to the base workstation until the test is over?
It sounds as if you expect to have two things executing at the same time, something looking at the base workspace, together with the GUI. Which mechanism are you using for this multiple execution ?
Jens
Jens 2013년 3월 7일
편집: Jens 2013년 3월 7일
Hi Jing and Walter, thank you for your interest in my problem.
I run the .m file of the GUI from main Matlab and clear all existing variables in the base workspace. The GUI has a ‘START’ button and when pressing that the test begins. A lot of information is passed to the command window of main Matlab by disp() and the process can be monitored and pre-analyzed (i.e. read that the variables look OK, not analyzed by other scripts) by a user siting there an reading. But the testing time can vary a lot, from a couple of minutes to several hours (potentially days).
We do not have time to sit there and observe the testing like that. Therefore I like to use the Matlab Connector to be able to check these variables remotely by my smartphone and get indications on when the testing is done.
So basically I only need to view the variables in real time, not run other scripts on them. But to do that the variables need to be in the base workspace.
But as for now the variables are only passed to the base workspace when the test is ended, with the last content.
As I see it this is a very strange behavior, I expected assignin() to work in real-time…
I would not have thought that MATLAB Connector would allow viewing values while the program was running ?
I wonder if you could get VNC for your smartphone, and use that to view the running MATLAB ?
Alternately, if you diary(), then apparently as of R2012b (maybe even R2012a, I am not sure), the buffer flushes are intended to allow the diary file to be viewed as it is produced, thus allowing you a different approach entirely to see how far the program has proceeded.
Hmm,... the diary() procedure looks interesting. I look in to that possibility right away.
Maybe the VNC can work as well, but I do not know much about how to connect to Matlab that way. I might search this forum for some guidance.
If you are using Linux or OS-X as your OS, you would run VNC Server with particular ports mapped to permanent pseudo-windows or you would use VNC Server with ports mapped according to graphics resolution, and you would start MATLAB under "screen" and log in through the VNC session and use "screen" to connect to the existing session (using "screen" is more robust than VNC alone.)
If you are using MS Windows on the system you are running MATLAB on, then you would run the VNC Server as a task with desktop access.
Jens
Jens 2013년 3월 12일
Walter, since we are getting in to a critical part of the tests and it will run for some time, I did not get the time to fully investigate the possibilities you suggested yet.
As a “precaution” I would like to thank you now for your help before I forget it :)

댓글을 달려면 로그인하십시오.

답변 (1개)

nanren888
nanren888 2013년 3월 7일

0 개 추천

Is the assignin() in a GUI callback? I guess these callbacks will not run, be queued if the main-line does nothing to let another thread get some time, eg drawnow, ... Can you see the callbacks running?

댓글 수: 1

Hi nanren888,
Yes, some of the assignin() are in GUI callbacks, some are in sub functions. The callback in question is the one running the sub functions and it is the main testing callback, the START button. All disp() that is placed in that callback and sub functions are working as expected in real-time, but not the assignin()…
You can read my answer to Jing and Walters questions here above to get a little bit more info about what I like to achieve.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Debugging and Analysis에 대해 자세히 알아보기

제품

질문:

2013년 3월 6일

Community Treasure Hunt

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

Start Hunting!

Translated by