Effacer les filtres
Effacer les filtres

What this actually means?????

2 vues (au cours des 30 derniers jours)
Santhosh
Santhosh le 2 Mar 2017
Commenté : Santhosh le 2 Mar 2017
% Mygui('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in Mygui.M with the given input arguments.
How to use this??? Can this be used to call a sub function(namely a pushbutton) inside a gui from an external function which is a separate m file???

Réponse acceptée

Walter Roberson
Walter Roberson le 2 Mar 2017
I guess you could use it that way. I would not do that myself.
It is mostly for internal use by GUIDE, due to the way it creates wrapper code around callback functions in order to be able to pass the handles structure into each callback.
If you do use it, make sure you pass the correct hObject and event structure required by the target callback.
A cleaner way is to move the code you need activated into a function in a location accessible from both files, and have both places make appropriate calls into the work routine.
  7 commentaires
Walter Roberson
Walter Roberson le 2 Mar 2017
If you are using GUIDE, everything useful is within a callback, so you just pass that callback's copy of handles to the work_routine.
But if you just happen to have a different program from which you are invoking a GUIDE-created interface and you want to call the work routine from in there, then you first need to retrieve the handles structure. When you make an outside call to a GUIDE-created interface (by calling the function whose name is the GUI), then the routine returns the GUI figure handle as the return value. You would record that figure handle. From there,
handles = guidata(TheFigureHandle);
work_routine( handles );
Santhosh
Santhosh le 2 Mar 2017
Thanks Walter. I got it.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Migrate GUIDE Apps dans Help Center et File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by