MATLAB: When i push a button i want to load image on axes in GUI. so i tried this.

imshow gui

function pushbutton2_Callback(hObject, eventdata, handles)
k=zeros(100,99);
z=imshow(k);
imshow(z, 'Parent', handles.axes1);
*also tried this
function pushbutton2_Callback(hObject, eventdata, handles)
k=zeros(100,99);
imshow(k, 'Parent', handles.axes1);
but still nothing appears on axes1

Best Answer

The problem is you were calling imshow to display the image, but then immediately after that you display only the handle ID, which is a single value. Don't do that.
Just do this:
imshow(k, 'Parent', handles.axes1);
Don't call imshow() twice.
Related Question