How to pass values between callback functions in GUI?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I know my question have been repeated many time in this platform, but since I have tried some suggested answers and get nothing to solve my problem, I am writing this question. I have made a GUI that includes different components. My general problem is how to pass values of different callback functions from one to other. For example in my GUI, I have two push-button callbacks, one for plotting and the other one for clearing the figure, that is out of GUI window/figure.
function pbplot_Callback(hObject, eventdata,handles) % plotting function (push-button)
figure (1)
plot(x,y, 'color', [a b c], 'linestyle', d)
hplot = findobj('Type','figure');
hold on % this is for adding new graphs
handles.hplot = hplot
guidata(hObject,handles)
function pbclear_Callback(hObject, eventdata,handles) % clearing function (push-button)
hplot = handles.hplot;
clf (hplot)
guidata(hObject,handles)
The error I get when I push the plot push-button is "Attempt to reference field of non-structure array." referring to "guidata(hObject.handles)". Getting information from handels, within plot callback function, shows "hplot: {2x1 double]". Could someone please help me to find the problem.
PS: x,y,a,b,c, and d are intorduced to the plot callback function.
2 Kommentare
Antworten (1)
Siehe auch
Kategorien
Mehr zu Interactive Control and Callbacks finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!