Clear the content of axes under panel using push button

조회 수: 5 (최근 30일)
sandeep singh
sandeep singh 2019년 2월 22일
답변: Cris LaPierre 2019년 4월 9일
Hello all ,
I have created a panel under which axes has been created, if i want to clear the content of the axes with the help of push button how can i do it.
cla (handle.......);, i am not able to write proper handle .
this is my peace of code.
DigitalImagePanel = uipanel(...
'Parent',GPT3MovablePanel,...
'FontUnits',get(0,'defaultuipanelFontUnits'),...
'Units',get(0,'defaultuipanelUnits'),...
'Title','',...
'BorderType','none',...
'Tag','uipanel',...
'FontSize',11,...
'Position',[0.0001 0.69 1.0 0.16]);
DigitalCompensatorImagePanel1 = uipanel(...
'Parent',DigitalImagePanel,...
'FontUnits',get(0,'defaultuipanelFontUnits'),...
'Units',get(0,'defaultuipanelUnits'),...
'Title','Z-Domain Cascaded T/F ',...
'Tag','uipanel11',...
'FontSize',11,...
'Position',[0.0001 0.5 0.5 0.50]);
ZDomainCascadedImageAX = axes(DigitalCompensatorImagePanel1,'Position',[0 0 1 1]);
ZDomainCascadedImage = imread('CascadedDisc.png');
imshow(ZDomainCascadedImage,'Parent',ZDomainCascadedImageAX);
set(ZDomainCascadedImageAX,'Units','pixels');
resizePosZDomainCascadedImageAX = get(ZDomainCascadedImageAX,'Position');
ZDomainCascadedImageResize=imresize(ZDomainCascadedImage, [resizePosZDomainCascadedImageAX(4) resizePosZDomainCascadedImageAX(3)]);
imshow(ZDomainCascadedImageResize,'Parent',ZDomainCascadedImageAX);
set(ZDomainCascadedImageAX,'Units','normalized');
thanks in advance

답변 (1개)

Cris LaPierre
Cris LaPierre 2019년 4월 9일
The code would be
cla(ZDomainCascadedImageAX)
Your issue is more likely related to variable scope. The pushbutton will have it's own callback function. You need to somehow pass the axes handle into the pushbutton callback. Since it looks like you are creating this app programmatically, consider looking at this example for how to achielve that.

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by