MATLAB: How to display an image in UI Figure on app designer

appdesignerMATLABmatlab gui

How can i display the figure i select from the folder in UI figure of App designer? I am using version 2016a and as per the code below, when i click the "button", the image opens in a different window.
% Button button pushed function
function ButtonButtonPushed2(app)
[file,path]=uigetfile({'*.jpg';'*.bmp';'*.gif';'*.tiff'}, 'Select file');
a= imread(file);
imshow(a);

Best Answer

Try this:
imshow(a, 'parent', app.UIAxes);
But, you'll run into issues with having all this x, y, title of axes still shown and taking up space. See this post to fix that issue: