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

Doug’s Pick of the Week

August 3rd, 2007

Dynamic GUIs with GUIDE

I recently got a question via e-mail from a reader of this blog. This MATLAB user wanted to know:

If you are thinking about another tutorial, can you show if it is possible to build a dynamic GUI, i.e., instead of actions opening other GUI’s, the parent GUI layout itself changes to offer user more content within the same GUI?

I do read and respond to all of my e-mails, so as requested here is a video about reconfiguring a GUI as it is running.

The files are all here on the File Exchange.

11 Responses to “Dynamic GUIs with GUIDE”

  1. Jette replied on :

    Doug,
    nice video - but this is a quite simple dynamic GUI. What if you don’t know how many elements of something you need because it depends on a users choice? And/or if you need to change the size of a GUI during runtime? That are things I still have no idea how to do it with GUIDE.

    Jette

  2. Doug replied on :

    Jette,

    Excellent idea for a new movie. The dynamic resizing should not be a problem, ‘position’ is a property of the GUI that you can change with set and get as shown here with visibility.

    However, adding N buttons to a GUI based on user input, that might be done in a couple of ways. You could just have the maximum number of buttons and hide, unhide them. The other thing you might want to do is create them as needed. That is a little more complicated and will take a short movie to explain.

    Thanks for the input,
    Doug

  3. Ruben replied on :

    Hi Doug,
    I had the same question as Jette. This is my code

    ——————————————————–

    i = 2;
    x = get(handles.NFilter,’String’)
    % display x;
    j = str2num(x);
    k = 24;
    while(i

  4. Ruben replied on :

    Since my last question is cut half,
    How can i create dynamic callbacks?

  5. Mohammad Sarfaraz replied on :

    too much excellent;
    I was wondering if you could possibly make a GUI which simulate “impact” of 2 particles with the given velocity.This subject comes from the Dynamic Lessons.

    Mohammad Sarfaraz
    Mohammad.Sarfaraz@gmail.com

  6. Doug replied on :

    Thank you for the kind words. I can only really make demos that are of general interest so I would not be able to do this. You may want to try finding collaborators on the Newsgroup.

    Doug

  7. Craig Mewis replied on :

    Hey Doug, thanks for all the great videos!
    I’m really learning alot here.
    In particular I’m looking for a movie along the lines of what Jette has asked. I’d like to create a certain number of boxes as I need them, I’d rather not do the hiding/unhiding as I think that may create problems later on (trying to think ahead)
    A video on this subject would be excellent.
    Thanks,
    Craig

  8. Muzaffar replied on :

    hi dear Doug,

    this is always nice to see your videos. it would be nice of you if you please take care of the move pointer/cursor position in your presentations.
    It would be nice if you please present a simple example how to load data into matlab (say from xls file) after making some process saving back to the file or to xls.

  9. Doug replied on :

    Muzaffar,

    Thank you for the comments. This is actually one of my earlier movies, I think you will find I have gotten better about parking the cursor as I go.

    That is a great idea to write out an Excel file when I am done. I will make one of those soon!

    Doug

  10. Santiago replied on :

    I really would like to know how to make dynamic callbacks. I have created a GUI where the user input determines the layout and produces a variable (aka dynamic) number of pushbuttons. HOWEVER, I am not sure how to assign to them different Callbacks (e.g. ‘Callback’, {@dyn0_Callback, hFigure} for the first, ‘Callback’, {@dyn1_Callback, hFigure} for the second, and so on until it creates the Nth pushbutton and assigns it ‘Callback’, {@dynN_Callback, hFigure}). The challenge really is not to assign different callbacks but to create the functions that correspond to the callbacks. Subsequently, I need to know how to create or emulate dynamic callbacks/functions.

  11. Doug replied on :

    I think that anonymous functions will serve you well here:

    http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_prog/f4-70115.html

    You will want to make these anonymous functions inside of another function. It is sort of like an anonymous function is the output of a different function.

    If I understand your question, this should be what you are looking for.

    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.



  • Moran: Hi Chris, I tried everything I could think of, and have sent several observations about this bug to support,...
  • odessit: Hello, I have compiled standalone application with deploytool. It would work fine, but the error is in...
  • Duane Hanselman: FYI… % strmatch replacements % strmatch is obsolete, strncmp and strcmp are built in % case...
  • Doug: Duane, I just looked, I did not see an m-lint warning against STRMATCH in 2008a. However, I seem to recall what...
  • hashem: Hi Doug, I built a GUI and write a help for it in “chm” (compiled HTML file) format, and I...
  • Tim Davis: I left out the comments in the code, above. Most of the functions should be familiar to most MATLAB users....
  • Tim Davis: I was a little confused by all the back-and-forth discussion of zero blocks. Is a block of zeros to be...
  • Tim Davis: Try this one. It doesn’t require any toolboxes, just “sparse” and “dmperm” ....
  • Duane Hanselman: Did anyone ever try replacing strmatch with strcmp (or its siblings as needed)? I recall mlint...
  • jiro: @Daniel, We do use the hardware, but we don’t expose the supersampling feature through that path, so if...

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

Related Topics