필터 지우기
필터 지우기

Save/Restore Variable Editor State

조회 수: 1 (최근 30일)
Jim
Jim 2012년 4월 24일
Since the sysadmins frequently force me to end my Matlab sessions at the end of the workday, I'd like to be able to restore a session as seamlessly as possible. I know how to do this for breakpoints, but does anyone know how to capture the set of variables open in the VE as well as their pane assignments and pane sizes? And conversely, how to restore the appearance of those panes at next startup?
If I can capture the list of variable names, I can simply loop over them in start.m with and call openvar for each, but that won't restore the panes.
  댓글 수: 2
per isakson
per isakson 2012년 4월 24일
I don't recognize the acronym "VE". Is that the name of a development environment?
Jan
Jan 2012년 4월 25일
*V*ariable *E*ditor

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

답변 (3개)

Daniel Shub
Daniel Shub 2012년 4월 24일
Why not just suspend/hibernate your machine? You could also run MATLAB in a virtual machine and then suspend that machine.

per isakson
per isakson 2012년 4월 24일
I don't recognize the acronym "VE"
Use SAVE and LOAD to handle the variables in the base workspace.
list = who;
creates a list of the names of the variables. You have to save list somewhere.
[Desktop] in the menu bar and the [Save Layout] will save the ....

Jim
Jim 2012년 4월 25일
VE = Variable Editor
Daniel, the sysadmins insist that all users log off so that patches can be pushed. There are frequently restarts required as well, so suspend/hibernate isn't an option, unfortunately.
Per, who creates a list of all variables open in the workspace. I'm only interested in those that are open in the VE at close of session. Moreover, I'd like more than just the list. To really restore everything I also need which pane each variable is assigned to and maybe the pane locations and sizes.
I think I might be getting somewhere on this. Based on this post: http://blogs.mathworks.com/desktop/2008/04/21/variable-editor/, I tried
jDesktop = com.mathworks.mde.desk.MLDesktop.getInstance;
which returns a handle to the Matlab desktop (which is a Java object).
jDesktop.getClientTitles()
then returns a cell array of strings listing all Desktop components/panes/(whatever the correct term is) that are currently open:
'Command Window'
'Command History'
'Current Folder'
...
'C:\Users\...\<matlab_src_file_1>'
'C:\Users\...\<matlab_src_file_2>'
...
'var1'
'var2'
...
The first set of names are built-in Matlab components, the 2nd set are the source files currently open in the Editor, and the last set are the variables open in the VE. The source files are listed in tab order from left to right, and the variables are similarly listed in pane order. If I save the last set, I should be able to restore them at next session start by simply looping over the list with calls to openvar() on each. (Hopefully they'll appear in the same panes.) This is pretty cool stuff.
  댓글 수: 1
Daniel Shub
Daniel Shub 2012년 4월 25일
You really should make these into comments on the appropriate answers and add what you have found to the original question as an edit.
I still say go with MATLAB in a virtual machine. Also tell your sysadmins that you are running simulations that need to run overnight and that they can ...

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

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by