Handles variable in GUIDE is not updating

Hi, everybody.
I already looked for an answer throughout content in MatLab website, but I didn't found a solution, even that there are some questions with this subject like in: http://www.mathworks.com/matlabcentral/newsreader/view_thread/259633 It didn't is the solution (and I read all the guidata's doc, like suggested). My problem is that I recorded an information in the "handles" structure within one GUIDE's function and I can't retrieve this information in another function.
Take a look, please, in this simple example: http://paste.ideaslabs.com/show/3L45QfKTL
And as soon as I execute the GUI I get this error message: http://s11.postimage.org/5trvp5c83/Captura_de_tela_2012_08_06_a_s_12_25_55.png
I tried to change the UIWAIT variable (<http://paste.ideaslabs.com/show/6QQr4NqA4A>), to wait the user close the window, after click in button, and then try to take the handle variable. But it doesn't work too, like you can see here: http://s7.postimage.org/5s6lk8tyj/Captura_de_tela_2012_08_06_a_s_12_31_31.png
Please, I need to finish a work and I can't because of this issue. Any help will be welcome. Thank for your attention.

1 件のコメント

Seyhan Emre Gorucu
Seyhan Emre Gorucu 2012 年 8 月 6 日
I had the same problem. finally, I put all the functions inside the main function. Now it works well.

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

回答 (1 件)

Sean de Wolski
Sean de Wolski 2012 年 8 月 6 日
編集済み: Sean de Wolski 2012 年 8 月 6 日

0 投票

It is not updating because you are calling guidata with hObject in the pushbutton's callback. hObject in the pushbutton's callback will be the pushbutton, not the figure.
Thus you would want:
guidata(handles.figure1,handles) %or handles.(whatever the tag for the figure is)

カテゴリ

ヘルプ センター および File ExchangeMATLAB についてさらに検索

製品

質問済み:

2012 年 8 月 6 日

Community Treasure Hunt

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

Start Hunting!

Translated by