Clear the content of axes under panel using push button

9 次查看(过去 30 天)
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