I am developing a program for a company.
In the GUI I first grouped a number of checkboxes into one handle object (for instance I have 10 checkboxes).
for i = 1 : 10 checkboxes(i-1) = handles.(sprintf('checkbox%d', i));endhandles.checkboxes= checkboxes;
Then I used the addlistener function to detect any changes for the group of checkboxes.
addlistener(handles.checkboxes, 'Value', 'PostSet', @(hObject, eventdata, handles) callback(hObject, eventdata, handles));
In the callback function, I wanted to update the value for 'anyObject' and in the end of the function I updated the handles structure so that the value of the 'anyObject' can be used by other functions.
function handles = callback(hObject, eventdata, handles)handles.anyObject = get(handles.checkbox1,'Value');% Update handles structure
guidata(hObject, handles);
The problem I have is that the program always throws me this error whenever I click the checkbox button:
Warning: Error executing listener callback for PostSet event on Value dynamic property in object ofmatlab.ui.control.UIControl class:Not enough input arguments.
Best Answer