Problem in CurrentFigure or in gcf

3 ビュー (過去 30 日間)
john
john 2014 年 1 月 16 日
コメント済み: john 2014 年 1 月 19 日
Hi,
this is my code after pressing pushbutton:
h=findobj(0,'Type','figure','Tag','figure1');
UserData=get(h,'UserData');
h=figure;
set(gcf, 'units','normalized','outerposition',[0 0 1 1],'name','a','numbertitle','off'); % Maximize figure.
g=plot(t,x);
UserData.d=7;
set(h,'UserData',UserData);
guidata(hObject, handles);
Why I do not have UserData.d=7 in others pushbuttons? Thank you

採用された回答

Image Analyst
Image Analyst 2014 年 1 月 16 日
  1 件のコメント
john
john 2014 年 1 月 19 日
thank you

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

その他の回答 (1 件)

Amit
Amit 2014 年 1 月 16 日
Because UserData is not defined for other callback functions. That is why you cannot access UserData with other pushbuttons. You can define it global and that will allow this being accessed by other callbacks.
  1 件のコメント
john
john 2014 年 1 月 16 日
編集済み: john 2014 年 1 月 16 日
How can I do it?
I always use UserData between callbacks.

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

カテゴリ

Help Center および File ExchangeInteractive Control and Callbacks についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by