I have a GUI that I 've created in MATLAB. In a callback, I pass the handles variable as an input to another subfunction. In the subfunction, I add fields to the handles structure, and assign data to the fields. I then use GUIDATA to store the updated handles variable, such as in the following code:
% callback
function callback(hObject,eventdata,handles)subfunction(handles);v = handles.newfield;% subfunction
function handles = subfunction(handles)handles.newfield = 1;guidata(handles.figure,handles)
When control returns from the subfunction to the callback, I attempt to use the newly added fields. However, this results in the following error message:
??? Reference to non-existent field 'fieldname'.
Best Answer