Saving all handles behind current GUI as .mat using uiputfile style save dialogue?
조회 수: 4 (최근 30일)
이전 댓글 표시
Hi all,
Is there any way I can save the handles behind one of my GUI windows, using the explorer save dialogue box, like you see with uiputfile?
I am trying to avoid moving all of the handle variables one at a time to the workspace, prior to saving the workspace with uiputfile. However, I am unsure if I can adapt the uiputfile function for saving handles rather than the workspace.
Does anyone have any suggestions?
(This is unrelated to my other GUI data saving question last week which I am yet to continue working on).
Thanks in advance,
Matt
댓글 수: 0
답변 (1개)
Adam
2016년 9월 5일
'handles' is just a variable within the workspace of every GUI callback so you can just save it like you would any other variable as
save( 'someFile.mat', 'handles' )
Whether or not it is a good idea to do is another matter, but purely from the standpoint of how to do it I don't see where the problem is.
댓글 수: 5
Adam
2016년 9월 5일
That is just a case of saving data objects to mat files (whether they are classes, structs, cell arrays, individual variables, whatever they may be).
Then you can pass these into a GUI at startup as an initial state and write a function that initialises the GUI from this initial state (called from the OpeningFcn).
This is how I write most of my GUIs (though I don't usually save much to file, just store them in objects) because I allow parameter windows to be opened and closed freely and of course when they are reopened they need to represent the current state of the parameters, not a default state.
This is nice and easy with classes, but still doable with structs without much more difficulty.
참고 항목
카테고리
Help Center 및 File Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!