Clear the content of axes under panel using push button

7 views (last 30 days)
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

Answers (1)

Cris LaPierre
Cris LaPierre on 9 Apr 2019
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.

Categories

Find more on Interactive Control and Callbacks in Help Center and File Exchange

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!