Table, Popup, Initial Value Problem

4 ビュー (過去 30 日間)
Melvin
Melvin 2012 年 10 月 8 日
Hi everyone. Here again to ask for your help. So in my gui I've got a table and a pop up menu and a pushbutton. When the program is ran, Initial values are inputted to the table. Then I would choose one among the methods listed in the pop up menu. Then click a push button. Each methods are different in terms of calculation method in my program's case. But they are in common after each calculation is completed. The table are being updated with new values. In other words, the initial values are replaced.
Inside the popup callback, I did not put anything
Inside the pushbutton callback, I did the "switch" cases of the popup(used first the get handles of the popup---'value').
Sorry for the long intro. So what I want to happen next is that after completing one method, I want to change to another method by directly choosing from the popup. Upon choosing, I want the table to display back its initial values. So whenever I choose different methods, I do not know how to automatically display back the initial values. Please tell me the codes and where to pud these codes.. Thank you very much
  1 件のコメント
Walter Roberson
Walter Roberson 2012 年 10 月 8 日
Please read the guide to tags and retag this Question; see http://www.mathworks.co.uk/matlabcentral/answers/43073-a-guide-to-tags

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

回答 (1 件)

Julien
Julien 2012 年 10 月 8 日
Hi,
You can add
set(handles.mytable,'Data',myinitdatas)
inside the pop up menu callback
  2 件のコメント
Melvin
Melvin 2012 年 10 月 8 日
編集済み: Melvin 2012 年 10 月 8 日
Hi Julien,
Thanks for the reply. Anyway, I think if you code it like this:
myinitdatas=get(handles.mytable,'Data')
set(handles.mytable,'Data',myinitdatas)
it would not work.
because after clicking the pushbutton, the table is updated to new values. so if you choose again from the pop up menu, the myinitdata gets the existing values in the table. Thus the initial values are not set on the table. What do you think?
Julien
Julien 2012 年 10 月 8 日
編集済み: Julien 2012 年 10 月 8 日
No I didn't mean that.
myinitdata contains the default values to apply when you launch the GUI. You should not modify them if you want to restore these datas after each calculations.
It suggests you to store your initial values inside a matrix (or better, cell array), you can save it inside a .mat file, load it inside the GUI opening function (if you use guide). then you store this matrix inside the handle structure (kind of datas.myinitvalues=myinitvalues.)
so
set(handles.mytable,'Data',handles.myinitdatas)

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

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by