Problem in CurrentFigure or in gcf

조회 수: 17 (최근 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개)

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 CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by