Changeset 591 for trunk/src/fill_GUI.m
- Timestamp:
- Mar 25, 2013, 5:43:18 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/fill_GUI.m
r569 r591 1 1 %'fill_GUI': fill a GUI with a set of parameters from a Matlab structure 2 2 % ----------------------------------------------------------------------- 3 % function errormsg=fill_GUI(Param, handles)3 % function errormsg=fill_GUI(Param,GUI_handle) 4 4 % OUPUT: 5 5 % errormsg: error message, ='' by default … … 11 11 % see also the reverse function read_GUI.m 12 12 % 13 function errormsg=fill_GUI(Param, handles)13 function errormsg=fill_GUI(Param,GUI_handle) 14 14 %------------------------------------------------------------------------ 15 15 errormsg=''; 16 handles=guidata(GUI_handle); 17 UserData=get(GUI_handle,'UserData'); 16 18 fields=fieldnames(Param);%list of fields in Param 17 19 % loop on the elements of the input structure Param … … 21 23 if isfield(handles,fields{ifield}) 22 24 set(handles.(fields{ifield}),'Visible','on') 23 children=get(handles.(fields{ifield}),'children'); 24 for ichild=1:numel(children) 25 hchild.(get(children(ichild),'tag'))=children(ichild); 26 end 27 errormsg=fill_GUI(Param.(fields{ifield}),hchild);% apply the function to the substructure 25 % children=get(handles.(fields{ifield}),'children'); 26 % for ichild=1:numel(children) 27 % hchild.(get(children(ichild),'tag'))=children(ichild); 28 % end 29 % errormsg=fill_GUI(Param.(fields{ifield}),hchild);% apply the function to the substructure 30 errormsg=fill_GUI(Param.(fields{ifield}),handles.(fields{ifield}));% apply the function to the substructure 31 % if the input sub-structure fits with a tag name of the GUI and a 32 % substructure of UserData 33 elseif isfield(UserData,fields{ifield})&& isfield(handles,fields{ifield})&&isfield(Param.(fields{ifield}),'Name') 34 UserData.(fields{ifield})=Param.(fields{ifield}); 35 set(handles.(fields{ifield}),'String',Param.(fields{ifield}).Name) 28 36 end 29 37 % case of an element
Note: See TracChangeset
for help on using the changeset viewer.