Problem in CurrentFigure or in gcf

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

Più risposte (1)

Amit
Amit il 16 Gen 2014

0 voti

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 Commento

john
john il 16 Gen 2014
Modificato: john il 16 Gen 2014
How can I do it?
I always use UserData between callbacks.

Accedi per commentare.

Categorie

Scopri di più su Interactive Control and Callbacks in Centro assistenza e File Exchange

Tag

Richiesto:

il 16 Gen 2014

Commentato:

il 19 Gen 2014

Community Treasure Hunt

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

Start Hunting!

Translated by