MATLAB: Add image (logo) to GUI and hide it with pushbutton

add image to guiguihandle of image in gui

Dear all,
I would like to add a logo to my GUI and only display it when a check box is marked.
I add the logo by:
axes(handles.SmileG)
smileg=imread('logo.jpg');
image(smileg);
axis off
axis image
This works fine, but now i would like it to be removed / hidden when a box is marked. I know how to hide something with setting the visible to off/on.
Smile_Status = get(handles.Smile,'Value');
if Smile_Status == 1
set(handles.SmileG,'visible','on');
else
set(handles.SmileG,'visible','off');
end
The problem is that now the original axis, used to get the figure in the GUI hide / appear. I need to get the handle / add handle to the figure added instead.
Anyone has an idea?
Kind regards

Best Answer

Toggle the visibility of the image, not of the axes:
axes(handles.SmileG)
smileg=imread('logo.jpg');
handles.SmileLogo = image(smileg);
axis off
axis image
guidata(hObject, handles);
And in the callback of the checkbox:
function CheckboxCallback(hObject, EventData, handles)
Smile_Status = ;
if get(handles.Smile,'Value')
set(handles.SmileLogo, 'visible', 'on');
else
set(handles.SmileLogo, 'visible', 'off');
end