Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
simple gui (GUIDE) help

Subject: simple gui (GUIDE) help

From: Josh

Date: 6 Jul, 2011 18:42:10

Message: 1 of 4

I am hoping to get a little help running a GUIDE gui. Right now, I have a program that works by entering numbers and text at the command line.

What I would like to do is create a very simple GUIDE gui, with a few fillable text lines, and one button. (Using underscore as the fillable text portion, and stars to encapsulate the button) This is what it could look like:

       "Enter the values below, then click Execute"

                   A= __________________
                   B= __________________
                   C= __________________
        FileName= __________________

                            **EXECUTE**

So the user would enter in values such as 3.54 etc.. for A, B, and C, and text into the fileName, then once the "Execute" button is pressed, I would like these variables (A, B, C, and Filename) to be populated with the user input, and I would like my program to be initialized which uses these variables (so my .m file would be called and loaded with the variables)

I have looked over many gui examples, and have a Matlab GUI book that I am reading, so I have no excuses for my ignorance, but alas I have failed. It looks like I should be able to use "var=get(hObject,'ProperyName') under the button callback to get the data, and var=str2num(var) to convert the numbers from the user input text to actual numbers, but somehow I still seem to botch this up.

If anyone has some time to e-mail me an example code with a sample GUIDE gui and it's .m file defining all of the handles etc.., It would help me understand better how to properly create the gui, afterwhich, I will attempt to create the real gui required for my code.

Thanks,
    Josh

Subject: simple gui (GUIDE) help

From: Steven_Lord

Date: 6 Jul, 2011 18:47:36

Message: 2 of 4



"Josh " <joshinbox@hotmail.com> wrote in message
news:iv2aa2$sa3$1@newscl01ah.mathworks.com...
> I am hoping to get a little help running a GUIDE gui. Right now, I have a
> program that works by entering numbers and text at the command line.
> What I would like to do is create a very simple GUIDE gui, with a few
> fillable text lines, and one button. (Using underscore as the fillable
> text portion, and stars to encapsulate the button) This is what it could
> look like:

*snip*

Rather than building your own GUI for this purpose, have you considered
using an INPUTDLG dialog box? Try executing the example in HELP INPUTDLG and
see if it does what you need from your input GUI.

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: simple gui (GUIDE) help

From: Josh

Date: 6 Jul, 2011 19:19:11

Message: 3 of 4

Hi Steve,

   Cool, I didn't know such a thing existed. Unfortunately, the real code is much more involved, and so once I learn how to create and manipulate the input fields with a pushbutton, I would then like to include figures on the gui, and perhaps a fillable spreadsheet along with a status bar.
   Once this is completed, I am going to use the Matlab compiler to create a standalone program.
    So I am basically trying to learn how to create cool gui's, so that in the future I will be able to develop standalone programs that will be user friendly (I am obviously a ways off)

   Any help to point me in the right direction, such as say a "Matlab GUIDE for Dummies" online tutorial etc... would be very helpful.

Thanks again.

Subject: simple gui (GUIDE) help

From: ImageAnalyst

Date: 6 Jul, 2011 19:40:09

Message: 4 of 4

Try MAGIC:
http://www.mathworks.com/matlabcentral/fileexchange/24224

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
optionally apply a mask (region of interest) to the image so that only
the area within the mask will be analyzed. The results are optionally
sent to Excel. In this demo, I do some very basic particle sizing but
in use, the user would replace that simple demo code in the function
AnalyzeSingleImage() with their own code. Works with Windows or Unix
since paths are all forward slashes. Requires the Image Processing
Toolbox to do the simple particle sizing demo, but if you delete that
demo code before using it, then the IP toolbox would not be required
and it would still demonstrate the basic GUI-based file processing
functionality.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us