Callback issue with uiMenu
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Having some issues with callback using uimenu, when a certain option is selected I want it to change the color map of the whole figure. Here is my code.
Function Startup
fig = figure('Toolbar','none','MenuBar','none')
Main = uimenu(fig,'Label','File');
ImageSettings = uimenu(File,'Label','Jet',...
'Callback', 'CM1');
end
function CM1
%colormap(jet)
disp('Jet')
end
The error that occurs is
Too many input arguments.
Error while evaluating uimenu Callback
Also I have tried to change my callback from: 'Callback', 'CM1'); to
'Callback', @CM1);
That did not seem to work either.
0 Kommentare
Akzeptierte Antwort
Jan
am 22 Mai 2013
Bearbeitet: Jan
am 22 Mai 2013
The function CM1 requires 2 input arguments as all callbacks:
function CM1(ObjectHandle, EventData)
You do not have to use the values, but they must exist.
Another idea would be an anomyous function to crop the inputs:
'Callback', @(x,y) CM1
But this looks more confusing, in my opinion.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Interactive Control and Callbacks finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!