Skip to Main Content Skip to Search
File Exchange
MATLAB Newsgroup
Link Exchange
  Blogs  
 Contest 
MathWorks.com

Doug’s Pick of the Week

November 13th, 2006

From the inbox: how to change properties in GUIDE from a button press

These GUIDE tutorials (Intro, Advanced) have been very popular since I posted them. Recently, someone asked me a question that I did not answer in the videos. They wanted to know how to change properties of widgets in GUIDE when a user presses a button.

Here is my answer:

Get the files here.

10 Responses to “From the inbox: how to change properties in GUIDE from a button press”

  1. zia replied on :

    Hello,
    Thanks for the video.
    Okay building on this example, how would one create a program that does this:
    When the push button is pressed, a box opens up which allows one to enter some string into a text box and this string is then displayed in the static text box of the original figure?

    Thanks,
    –zia

  2. Doug replied on :

    Zia,

    To do something like this, look at the “modal question dialog” template that you can choose when you start Guide. This GUI will return a value when it is closed using this command:

    “handles.output = get(hObject,’String’);”

    Once you have that output (by saying something like “str = modalUI”) then you can use that string to populate a static text box as shown in my original video.

    I hope this is useful. Let me know!

    Doug

  3. john replied on :

    Mini Videos are very good.

    Thank you

    Keep it up

    Now all we have to do is get Loren on video as well!!

  4. Loren Shure replied on :

    John-

    What topic(s) would you like to hear about?

    –Loren

  5. Allan replied on :

    Hi,

    I’d like to ask if this could be done but writing out to a uicontrol edit text box. I’ve tried to implement a button to change the content of the edit text but with no results…
    Thanks!

    ps. i’m not using Guide

  6. Doug replied on :

    Allan,

    You should be able to do this by seting the String property of the edit box:

    set(handles.edit1, ’string’, ‘foo’)

    Doug

  7. Allan replied on :

    Hi Doug,

    Thanks for the tip but I can’t get it to work, although your suggestion is the correct procedure.
    Could it be a panel issue? (the push button it is linked to a panel handle).
    I think I’m missing something…
    Any help would be much appreciated.

    Regards,

    Allan

  8. Allan replied on :

    UPDATE:
    Issue solved. I just fixed some handles mismatches…

    Thanks!

  9. Michael replied on :

    How can I download your vedio?

  10. Doug replied on :

    Michael,

    I just added a link to the video on the File Exchange right under the video.

    Doug

Leave a Reply


Doug Hull is an Application Engineer at The MathWorks. A MATLAB user since 1994, he gets paid to live, eat, and breathe MATLAB! This blog is dedicated to promoting the File Exchange by highlighting files and original video content.



  • pierre: Hi sherryl and thank you for answering me, Actually, I already tried before to use this property because I...
  • Sherryl: In Response to Post #10 by Bryan - Hi Bryan, By default the analog input object will acquire one second...
  • Sherryl: Hello Pierre, Please look at the OutOfDataMode property. http://www.mathworks .com/access/helpd...
  • Scott Hirsch: Elya - In v7.0, try aviread. This has straightforward syntax for reading a single frame - you could...
  • Scott Hirsch: Eric - That’s a nice suggestion. I often get frustrated when debugging GUIDE guis and ending up...
  • pierre: Hi all, I have the Data Acquisition Toolbox, and I’m trying for 2 weeks to send a step voltage, and...
  • Eric S: It would be great to stop the debugger from coughing somewhere inside the more “internal̶ 1;...
  • Tareq: coef1 = rand(1,3)-0.5; coef2 = rand(1,3)-0.5; lex1=roots(polyder(c oef1)) lex2=roots(polyder(c oef2)) hold all...
  • Luca Balbi: While we’re at it… Checking for a number to be zero is tricky in itself. We’re better...
  • david: perhaps some error checking is in order. After all, it is possible that our randomly generated quadratic...

These postings are the author's and don't necessarily represent the opinions of The MathWorks.

Related Topics