I really need some concrete examples, because all those "ressources" out there doesn't explain it for me.
GUIDE, calling functions
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi all, might just be me, but I am having a hard time finding som info on GUIDE that I can use, I know nothing of GUIDE, but I know how to use and do code in matlab, but my problem is how to make a GUIDE that executes a function which lies in a seperate m-file when pushing a pushbutton
and also how to run a function with parameters, when i have two textboxes and a button, still running a function in a seperate m-file.
Is this even possible? searched google and mathworks without getting a usable answer.
Respuesta aceptada
Walter Roberson
el 26 de Mayo de 2011
2 comentarios
Walter Roberson
el 26 de Mayo de 2011
Set the CallBack property of the button to
{@(src, event, handles) YourFunctionName(Parameter1, Parameter2, ....)}
I am not completely sure if handles will be passed by default.
Más respuestas (8)
Ivan van der Kroon
el 26 de Mayo de 2011
A gui is just some visualization of some m-file. If you want to call a separate m-file you have to call it in the first one.
If you want to call this functions with parameters you have to set them in the m-file as well, probably by adding some slider in your gui and then call the m-file with these variables as input.
Remember that a gui is just an interface and the execution is in the m-file.
Ivan van der Kroon
el 26 de Mayo de 2011
When you are using the guide it is actually a gui for making gui's. What you are actually doing is making an m-file and this m-file makes a figure with some buttons, bullets and values. These are the callbacks and they are nothing else than changing values in the m-file's workspace.
For instance type
xpsound
and you see Matlab's sound capability gui. If you would instead type
edit xpsound
you get to see the m-file which generates this figure and its callbacks. In this case the volume bar is an example of a slider.
It appears that you only know how to make gui's with guide. Is that correct? I never made one with guide, but there should be a way to call other functions. If you cannot find it, I would suggest to add some arbitrary callback, save your gui and then change it in the m-file to execute another m-file of your choosing.
Johan
el 26 de Mayo de 2011
2 comentarios
Ivan van der Kroon
el 26 de Mayo de 2011
I'm sorry, but I'm not familiar with vba. There are a lot of tutorials in matlab to learn how to make gui's.
So, did you look into xpsound? The simplest action is the info-button. On line 330 it is checked for clicks and on line 331 it executes a simple command if it is clicked. Now just change this command with the m-file you want to call. You also mentioned assigning variables to the functions and lines 316-327 are examples of that.
Johan
el 26 de Mayo de 2011
3 comentarios
Walter Roberson
el 26 de Mayo de 2011
They are in the properties of the figure.
You either deleted something or renamed something.
Johan
el 26 de Mayo de 2011
3 comentarios
Ivan van der Kroon
el 27 de Mayo de 2011
I suppose you want to implement the correct figure handles?
Johan
el 27 de Mayo de 2011
1 comentario
Ivan van der Kroon
el 30 de Mayo de 2011
Well, your doing handles when using figure! Nice to get it working!
Ver también
Categorías
Más información sobre Migrate GUIDE Apps en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!