toggle button callback did not function

function closepump_Callback(hObject)
%CLOSEPUMP Summary of this function goes here
% Detailed explanation goes here
global GUI
if get(hObject,'value')==1 % button down
set(hObject,'BackgroundColor',GUI.offcolor,... %yellow = pump running
'string',[valves open]);
elseif get(hObject,'value')==0 %button up
set(hObject,'BackgroundColor',GUI.menucolor,...
'string',[valves close]);
else
fprintf(2, 'callback object value was not 1 or 0, was %g\n', get(hObject,'Value'));
end
this is my callback of a togglebutton. However it said there are too many input arguments. How can I fix it?

Antworten (1)

Image Analyst
Image Analyst am 24 Dez. 2018

0 Stimmen

Try this:
function closepump_Callback(hObject, eventdata, handles)
I suspect the last two inputs somehow got deleted by accident.

2 Kommentare

Kuang-Yu WANG
Kuang-Yu WANG am 24 Dez. 2018
not this problem. But still thanks. I found out that is
'string',[valves close]
need to change to
'string','valves close'
No, that would not have made the difference for that error message. However, the missing input arguement locations would make a difference. See for example your July posting about this same software, in which you had coded
function checkpump(hObject, ~, ~)
Notice three input arguement slots.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Creating, Deleting, and Querying Graphics Objects finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 24 Dez. 2018

Kommentiert:

am 24 Dez. 2018

Community Treasure Hunt

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

Start Hunting!

Translated by