You need create uiaxes first and show the image on the axes.
First, add Axes component in Design View of App Designer. UIAxes will be added automatically.
properties (Access = public)
UIFigure matlab.ui.Figure
UIAxes matlab.ui.control.UIAxes
end
Next, uncheck Visible from INTERACTIVITY of app.UIAxes from Inspector pane.
Then, do imagesc or imshow by spcifying app.UIAxes.
function OpenButtonPushed(app, event)
[filename,filepath] = uigetfile({'*.*;*.jpg;*.png;*.bmp;*.oct'}, 'Select File to Open');
fullname = [filepath, filename];
ImageFile = imread(fullname);
imagesc(app.UIAxes, ImageFile);
end
Best Answer