From: Lukas on 13 Aug 2010 19:15 Hi folks! How can I code a selction a uibuttongroup element? Below I have pasted the SelectionChangeFunction as constructed by GUIDE. Within this function, I would like to change the users choice under certain circumstances. The propper comand might be: set(hObject,'SelectedObject',h); but I have no idea how access h. I tried: h = findobj(hObject,'Tag','No_Preselection'); Do I miss anything? Many thanks in advance, LS % --- Executes when selected object is changed in File_Preselection. function File_Preselection_SelectionChangeFcn(hObject, eventdata, handles) % hObject handle to the selected object in File_Preselection % 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) switch get(eventdata.NewValue,'Tag') % Get tag of selected object case 'No_Preselection' % do something case 'Use_Preselection' File = uipickfiles('REFilter','.mat$','num',1, 'out','char'); if File == 0 % no file was selected % change the choosen button to CASE 'No_Preselection' h = findobj(hObject,'Tag','No_Preselection'); set(hObject,'SelectedObject',h); else % do something end case 'Save_Preselection' % do something different end
|
Pages: 1 Prev: Loops used to flip cell array Next: Find approximate root of function of integer variable |