I have a GUI created in guide which has two axis on the GUI itself. I have a button which runs a separate function (which cannot be included in the GUI main script due to complexity) which generates two graphs. I want these two graphs to plot on the GUI. When I run the usual plotting method, one graph is plotted on the GUI, the other opens in a separate figure. How would I go about changing this?
As an example, I have created the below code. plot(x,y) plots on one axis on the GUI, plot(y,x) opens in a new figure.
function example
x=[1:10];
y=x.^2;
plot(x,y)
figure;
plot(y,x);
end

 채택된 답변

Birdman
Birdman 2017년 11월 26일

0 개 추천

x=[1:10];
y=x.^2;
subplot(2,1,1)
plot(x,y)
subplot(2,1,2)
plot(y,x);

댓글 수: 4

Nicholas Wills
Nicholas Wills 2017년 11월 26일
That works, but causes the GUI axis to resize. Do you have any idea how to stop this happening?
Birdman
Birdman 2017년 11월 26일
편집: Birdman 2017년 11월 26일
I actually don't know about it, but have a look at this tab:
GUIDE->Tools->GUI Options->Resizable Behavior
Nicholas Wills
Nicholas Wills 2017년 11월 26일
I meant the axis resizes not the whole GUI, but thank you anyway
For that, you need to set limits for x axes. With that, auto resizing will not happen.
set(gca, 'XLim', [0 10]);%as an example

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

카테고리

도움말 센터File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

제품

질문:

2017년 11월 26일

댓글:

2017년 11월 26일

Community Treasure Hunt

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

Start Hunting!

Translated by