MATLAB: Linking a graph to a pushbutton

graphgui

I HAVE A GUI THAT HAS 5 GRAPHS,
1.FFT
2.PSD
3.TIME DOMAIN PLOT
etc….
NOW I WANT EACH TO BE PLOTTED ON GRAPHS BY PRESSING PUSH BUTTONS SEPARATELY. BUT THE PROBLEM IS THAT THE GRAPHS ARE BEING PLOTTED ON THE SAME AXES EVERY TIME.WHAT SHOULD I DO TO LINK EACH PUSHBUTTON TO SEPARATE GRAPHS. PLSS HELP ME…

Best Answer

You can set each axes as the current axes with the axes commands:
axes(handleToAxes1);
plot(x1, y1);
axes(handleToAxes2);
plot(x2, y2);
axes(handleToAxes3);
plot(x3, y3);
Or send in the axes handle in to the function - most of them take an axes handle as an input argument:
plot(handleToAxes1, x1, y1);
imshow(imageArray, 'Parent', handleToAxes2);
bar(handleToAxes3, x3, y3);