필터 지우기
필터 지우기

Handle 2 axes in one GUI

조회 수: 2 (최근 30일)
Cheng Yoong
Cheng Yoong 2011년 12월 17일
답변: GANESH RATHOD 2017년 11월 11일
I create a GUI with 2 axes.
The first axes I would like just to display an image. Code i used is as below:
I = imread('file destination')
imshow(I)
The second one I would like to plot something on it.
Then i create a button to reset the second axes to initial condition.
But when i press it,it erase everything on second axes and the initial condition was set at first axes.
now the image on first axes was replace by the initial condition.
Anyone can help me?it's kinda urgent.
*the initial condition here is a 3D manipulator plot.
  댓글 수: 2
Chandra Kurniawan
Chandra Kurniawan 2011년 12월 17일
Would you tell me the code you used to reset the axes??
Cheng Yoong
Cheng Yoong 2011년 12월 17일
I've attached the GUI i've done so that you can get a clearer picture. You can download from here:
<<http://www.sendspace.com/file/gefazr>>
There are 2 axes that i've created. The smaller one i wish to display the robot.jpg which i've included in the folder.The bigger one is to plot the robot.But when execute it,the robot will plot at the smaller one.

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

채택된 답변

Chandra Kurniawan
Chandra Kurniawan 2011년 12월 17일
Hello,
I have modified your code :
  댓글 수: 16
Cheng Yoong
Cheng Yoong 2011년 12월 17일
That might help me.
I notice that the cylinder always started from point(0,0,0).
is that anywhere to change that?
Chandra Kurniawan
Chandra Kurniawan 2011년 12월 17일
Of course you can.
You can do modification on X Y Z values
Eq :
[X Y Z] = cylinder(1);
Z = 10*Z;
X = X-20;
Y = Y-5;
h=surf(X,Y,Z);
axis([-10 10 -10 10 -10 10]);

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

추가 답변 (3개)

Image Analyst
Image Analyst 2011년 12월 17일
The pushbutton to clear the second axes should just look something like
axes(handles.axes2); % Do this immmediately upon entering callback function
cla reset;
If it doesn't mention anything about handles.axes1 after you set the current axes to #2 then it will not do anything to axes #1.

Walter Roberson
Walter Roberson 2011년 12월 17일
My recommendation is to specifically parent all graphics activity. I give an example here, which also has a link to a post in which I explain why it is important.
  댓글 수: 1
Cheng Yoong
Cheng Yoong 2011년 12월 17일
i saw one of your example has the following codes:
f = figure();
ax = axes('Parent',f);
but the defined 'f' is to plot on a pop out axes.
if now i already have an axes in my GUI(tag with axes1), how am i going to define the 'f'?

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


GANESH RATHOD
GANESH RATHOD 2017년 11월 11일
for n = 1:3
if n==1;
axes(handles.axes1);
hold off;
cla reset;
elseif n==2;
axes(handles.axes2);
hold off;
cla reset;
else
axes(handles.axes3);
hold off;
cla reset;
end;
end;

카테고리

Help CenterFile Exchange에서 Specifying Target for Graphics Output에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by