필터 지우기
필터 지우기

toggle button callback did not function

조회 수: 2 (최근 30일)
Kuang-Yu WANG
Kuang-Yu WANG 2018년 12월 24일
댓글: Walter Roberson 2018년 12월 24일
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?

답변 (1개)

Image Analyst
Image Analyst 2018년 12월 24일
Try this:
function closepump_Callback(hObject, eventdata, handles)
I suspect the last two inputs somehow got deleted by accident.
  댓글 수: 2
Kuang-Yu WANG
Kuang-Yu WANG 2018년 12월 24일
not this problem. But still thanks. I found out that is
'string',[valves close]
need to change to
'string','valves close'
Walter Roberson
Walter Roberson 2018년 12월 24일
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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by