I have a GUI that has two axis. The first axis is my original image and the second axis is my filtered image where I am able to apply various filters to change the image. I have a Reset command which I want to Reset both axis's to be blank to allow the user to input another image. I used the matlab command.
arrayfun(@cla,findall(0,'type','axes'))
Which clears both axis but when I load an image it loads it into the second axis and not the first axis. Then when I apply filters it just filters the second axis image leaving the first one blank. Any ideas how to fix this? I have tried storing both axis as global variables and then using cla but this gives me the same problem as before.

 채택된 답변

Walter Roberson
Walter Roberson 2013년 12월 2일

0 개 추천

댓글 수: 2

I see. I am building a GUI that shows images on an axis that I already have so I can't use the f = figure(). And when I run my code
OriginalAxis = findobj(gcf,'Tag','axes1');
set(gcf,'CurrentAxes',OriginalAxis);
[M,N] = size(X);
ax = axes('Parent',OriginalAxis);
imshow(X);
when I run this I get the error
Error using axes An object of class axes, can not be a child of class axes.
Is there any way around this?
OriginalAxis = findobj(gcf,'Tag','axes1');
imshow(X, 'Parent', OriginalAxis);

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

추가 답변 (1개)

Image Analyst
Image Analyst 2013년 12월 2일

0 개 추천

Use this code:
axes(handlesToAxes1);
cla('reset');
axes(handlesToAxes2);
cla('reset');

댓글 수: 1

Tarik
Tarik 2013년 12월 2일
It doesn't work for me. Should it be handles.myAxisName also is it bad to call findobj multiple times in my code on the same object?

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

카테고리

도움말 센터File Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

질문:

2013년 12월 2일

댓글:

2013년 12월 2일

Community Treasure Hunt

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

Start Hunting!

Translated by