how to call the callback in GUI ?

5 visualizzazioni (ultimi 30 giorni)
Niki
Niki il 8 Set 2011
I put this label into the figure that I created but how can I active it ? I want to load data , do you have any idea?
m = uimenu('Label','&File'); uimenu(m,'Label','Open','Callback','Mohammad');
  2 Commenti
Jan
Jan il 8 Set 2011
What exactly does "I want to load data" mean? What do you mean by "activate"? Usually a menu is activated by the mouse event. Do you want to call the callback function Mohammad manually?
Niki
Niki il 8 Set 2011
Yes, It was what I wanted,
as you know based on above command you can just create a label but I did not know how to callback , but Wesley helped me and it works now,
right now i have another problem , please see the following question

Accedi per commentare.

Risposta accettata

Wesley Ooms
Wesley Ooms il 8 Set 2011
if i understand correct, instead of 'Mohammad', you should write {@Mohammad} so that it becomes
uimenu('Label','&File'); uimenu(m,'Label','Open','Callback',{@Mohammad});
now you can write your function
function varargout = Mohammad(varargin);
that function can load the data for you
  1 Commento
Amirhosein Ghenaati
Amirhosein Ghenaati il 6 Nov 2014
Modificato: Amirhosein Ghenaati il 6 Nov 2014
if you defines Mohammad in your current directory it works well too
m = uimenu('Label','&File');
uimenu(m,'Label','Open','Callback','Mohammad');
for example define new func in your directory
function Mohammad()
disp('rrr')
end

Accedi per commentare.

Più risposte (1)

Niki
Niki il 8 Set 2011
How can I add one bottom for this? for example this I have a windows , then i want to either open from the "file"---> "open" which works now
or a bottom on the window

Categorie

Scopri di più su Install Products in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by