How do i convert a .m file to a GUI

15 views (last 30 days)
NeoSeeker
NeoSeeker on 14 Mar 2015
Commented: NeoSeeker on 20 Mar 2015
I'm having a code that crops a portion of the image and finds the length of the line drawn on the image in terms of pixels. I'm new to MATLAb and a student so can someone help me out ?

Answers (2)

Adam
Adam on 14 Mar 2015
You can use Guide to create a GUI and then call your .m file function from a callback of a pushbutton or whatever control you want to use to trigger your code.
  4 Comments
NeoSeeker
NeoSeeker on 16 Mar 2015
I tried using the GUIDE method for creating the GUI but I have no idea how to apply the function . Can you tell me with an example of how to apply the function?
Adam
Adam on 16 Mar 2015
If you create a pushbutton then (assuming you have default GUIDE settings so that it created a .m file with the .fig) you will have a callback function for that
pushbutton1_Callback
if you didn't change the button's tag.
In that function you can call your other function although if you have inputs and outputs then that is more complicated as you need to get the inputs from somewhere.
Outputs can be saved on the handles structure as e.g.
handles.result = someFunction( );
guidata( hObject, handles )

Sign in to comment.


Image Analyst
Image Analyst on 14 Mar 2015
Description
This GUI will help the novice user get up to speed very quickly on using GUI-based applications. Everything is laid out in a very simple Step 1, Step 2, Step 3, etc. layout. It is a very good starting point for a typical image analysis application. This application uses GUIDE to do the user interface design, and has most of the basic controls such as buttons, listboxes, checkboxes, radio buttons, scrollbars, etc. It allows the user to select a folder of images, select one or more images and display them, to select a series of options, and to individually or batch process one or more images. The user can....................
  2 Comments
Image Analyst
Image Analyst on 16 Mar 2015
See my attached spatial calibration demo that lets you draw a line and get the length. Put that code into a callback function of your GUI.
NeoSeeker
NeoSeeker on 20 Mar 2015
Thank you Image Analyst, I didn't the part where I need to enter the real life distance. Can you explain that part of the code?

Sign in to comment.

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!