One issue that I'm having is with multiple places in SelectionChangeFcn callbacks in uibuttongroup objects.
I have lines of code, all similar to this:
set(handles.cmd_step_delay, 'Enable', 'off');
where cmd_step_delay is a edit style object inside of a uibuttongroup. The goal for this line of code is that I have multiple Radiobuttons in the uibuttongroup, and each has an associated edit box or edit boxes for certain parameters. I only want the associated edit boxes enabled when that particular radio button is selected.
If I first open up my figure in GUIDE, and press the Play button, there are no issues with this.
If, however, I open the figure from the desktop, and attempt to click on one of the radio buttons that does this, I get the error: "Attempt to reference field of non-structure array."
I want to be able to give this to an end user who will just run the form, I don't want them to have to open GUIDE just to run this. Is there something I'm doing wrong?
Here's the entire code for one of the callbacks, but there's not much to it:
function CMD_patt_SelectionChangeFcn(hObject, eventdata, handles)% hObject handle to the selected object in CMD_patt
% eventdata structure with the following fields (see UIBUTTONGROUP)
% EventName: string 'SelectionChanged' (read only)
% OldValue: handle of the previously selected object or empty if none was selected
% NewValue: handle of the currently selected object
% handles structure with handles and user data (see GUIDATA)
if strcmp(get(eventdata.NewValue,'String'), 'Step') == 1 set(handles.cmd_step_delay, 'Enable', 'on'); set(handles.cmd_step_ang, 'Enable', 'on');else set(handles.cmd_step_delay, 'Enable', 'off'); set(handles.cmd_step_ang, 'Enable', 'off'); end
Thank You.
Best Answer