How to display image in GUI using Matlab

Steps to display image in GUI using Matlab

Step 1: Open GUI

Open Matlab -> Go to Start -> GUIDE(GUI Builder)


Select Blank GUI(Default) in GUIDE Quick Start


Step 2: Create Axes

Click on axes and create axes. Adjust size (width x height) according to your necessary.


Step 3: Save GUI

Now save GUI and click on M-file Editor


Step 4: Write code to display image

Write code after guidata(hObject, handles) in Updata handles structure

axes(handles.axes1);
imshow('G:\display\sample_image.jpg')

Here sample_image is image name & display is folder where image is saved.
Axes1 is name of axes.

It looks like this

% Update handles structure
guidata(hObject, handles);
axes(handles.axes1);
imshow('G:\display\sample_image.jpg')


Step 5: Run GUI

Now click on Run button to see result.

8 Comments

Add your comments here

Back to Top