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.
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.
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.
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.
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.
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
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.
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.
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,
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
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
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
Since my last question is cut half,
How can i create dynamic callbacks?
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
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
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
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.
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
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.
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
I am just starting to learn GUIs in Matlab. This is a great tutorial sites…demos always help and saves a lot of time. I appreciate your efforts Doug.