Changeset 363 for trunk/src/read_GUI.m
- Timestamp:
- Jan 10, 2012, 9:13:31 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/read_GUI.m
r350 r363 16 16 check_input=1;%default 17 17 switch object_style 18 case {'checkbox',' pushbutton','radiobutton','togglebutton'}18 case {'checkbox','radiobutton','togglebutton'} 19 19 input=get(hchild(ichild),'Value'); 20 20 case 'edit' 21 separator=regexp(tag,' _');21 separator=regexp(tag,'^num_'); 22 22 if isempty(separator) 23 23 input=get(hchild(ichild),'String'); 24 24 else 25 switch(tag(1:separator)) 26 case 'num_' 27 input=str2double(get(hchild(ichild),'String')); 28 tag=tag(separator+1:end); 29 %deal with undefined input: retrieve the default value stored as UserData 30 if isnan(input) 31 input=get(hchild(ichild),'UserData'); 32 set(hchild(ichild),'String',num2str(input)) 33 end 34 case 'txt_' 35 input=get(hchild(ichild),'String'); 36 tag=tag(separator+1:end); 37 otherwise 38 input=get(hchild(ichild),'String'); 25 input=str2double(get(hchild(ichild),'String')); 26 tag=regexprep(tag,'^num_',''); 27 %deal with undefined input: retrieve the default value stored as UserData 28 if isnan(input) 29 input=get(hchild(ichild),'UserData'); 30 set(hchild(ichild),'String',num2str(input)) 39 31 end 40 end 41 42 % key=tag(7:end); 43 case{'Listbox','popupmenu'} 32 end 33 case{'listbox','popupmenu'} 44 34 listinput=get(hchild(ichild),'String'); 45 35 value=get(hchild(ichild),'Value'); 46 36 if ~isempty(listinput) 47 input=listinput(value); 37 input=listinput{value}; 38 else 39 check_input=0; 48 40 end 49 separator=regexp(tag,' _');50 if strcmp(tag(1:separator),'num_')41 separator=regexp(tag,'^num_'); 42 if ~isempty(separator) 51 43 input=str2double(input);% transform to numerical values if the uicontrol tag begins with 'num_' 52 tag= tag(separator+1:end);44 tag=regexprep(tag,'^num_',''); 53 45 end 54 46 otherwise … … 57 49 if check_input 58 50 struct.(tag)=input; 59 % eval(['struct.' tag '=input;'])60 51 end 61 52 case 'uitable' 62 53 struct.(tag)=get(hchild(ichild),'Data'); 63 54 end 64 55 end
Note: See TracChangeset
for help on using the changeset viewer.