linking a graph to a pushbutton

조회 수: 4 (최근 30일)
777
777 2012년 3월 29일
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...

채택된 답변

Image Analyst
Image Analyst 2012년 3월 29일
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);
  댓글 수: 1
777
777 2012년 3월 30일
i was using GUIDE and axes(handles.axes1) worked for me.
thank you

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Geoff
Geoff 2012년 3월 29일
You can use subplot() when you create your 5 graphs, and store the returned handles for each set of axes in your GUI. Then, when you push the button, pass the desired axes handle into plot (as the first parameter) to draw on those axes.

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by