Filter löschen
Filter löschen

What this actually means?????

2 Ansichten (letzte 30 Tage)
Santhosh
Santhosh am 2 Mär. 2017
Kommentiert: Santhosh am 2 Mär. 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???

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 2 Mär. 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 Kommentare
Walter Roberson
Walter Roberson am 2 Mär. 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 am 2 Mär. 2017
Thanks Walter. I got it.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by