How do I save and restore the state data in a GUI?

Can a GUI save my data?
If it can, how can I make pushbuttons to do this? One button to save the data and another button to clear the data.
For example I have a figure with a uitable. The user will enter the data and he will want to save the data (by use of pushbutton1) and then he will want to insert a new data. This will require that he is able to clear the table first (by use of pushbutton2).
Can someone give me a tutorials or some guide about it please?

回答 (3 件)

Paulo Silva
Paulo Silva 2011 年 2 月 18 日

3 投票

5 件のコメント

Doug Hull
Doug Hull 2011 年 2 月 18 日
What a soothing voice that guy in the video has.
Paulo Silva
Paulo Silva 2011 年 2 月 18 日
And he knows how to make good tutorials!
Doug can you please make some tutorials on how to use the bsxfun, arrayfun and cellfun? I bet that many new users might find those interesting and very useful :)
Matt Tearle
Matt Tearle 2011 年 2 月 18 日
I find Scotsmen the most soothing... Maybe you could find one to do the voiceover for your upcoming bsxfun/arrayfun/cellfun tutorials.
Paulo Silva
Paulo Silva 2011 年 2 月 18 日
Hey Matt you also have great matlab skills, do you also have a blog with tutorials? if not please don't waste your talents, share them with us ;)
Matt Tearle
Matt Tearle 2011 年 3 月 8 日
Sorry, Paulo, you have to pay to listen to me yap on about MATLAB. Which is a scary thought.

サインインしてコメントする。

Kenneth Eaton
Kenneth Eaton 2011 年 2 月 18 日

1 投票

41 Complete GUI Examples from Matt Fig on the FEX should be helpful as well, specifically example GUI_41.m.

1 件のコメント

Paulo Silva
Paulo Silva 2011 年 2 月 18 日
Those examples are really nice for anyone who is starting with GUIs.

サインインしてコメントする。

Francesco Scattarella
Francesco Scattarella 2017 年 8 月 30 日
編集済み: Francesco Scattarella 2017 年 8 月 30 日

0 投票

Hi, how can I do this with matlab2015b? I saved all the handles of my gui in a mat file, but when I load it, matlab open another figure. When I used the same code in matlab2012b I didn't have the same problem.

1 件のコメント

Jan
Jan 2017 年 8 月 30 日
Exactly. This is expected for the new HG2 graphics engine. Even loading a FIG file by load(File, '-mat') creates a figure. But saving the handles does not seem to be useful at all. These handles exist only as long as the figure is open. Then you can address them directly. Storing them in a MAT file cannot solve any problem. But perhaps you want to save the contents of the objects with these handles? Then you can store a cell of the 'String' and 'Value' properties together with the Tag of the uicontrol. Perhaps the contents of axes also?

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeCreating, Deleting, and Querying Graphics Objects についてさらに検索

タグ

質問済み:

2011 年 2 月 18 日

コメント済み:

Jan
2017 年 8 月 30 日

Community Treasure Hunt

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

Start Hunting!

Translated by