Changeset 180 for trunk/src/get_field.m
- Timestamp:
- Jan 18, 2011, 10:50:40 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/get_field.m
r179 r180 45 45 %------------------------------------------------------------------------ 46 46 % --- Executes just before get_field is made visible. 47 function get_field_OpeningFcn(hObject, eventdata, handles,filename, Field,haxes)48 %------------------------------------------------------------------------ 49 global nb_builtin 50 51 %% look at the existing figu es in the work space47 function get_field_OpeningFcn(hObject, eventdata, handles,filename,multiple) 48 %------------------------------------------------------------------------ 49 global nb_builtin % nbre of functions to include by default in the menu of functions called by RUN 50 51 %% look at the existing figures in the work space 52 52 browse_fig(handles.list_fig) 53 53 … … 61 61 set(hObject,'WindowButtonUpFcn',{@mouse_up_gui,handles}) 62 62 63 %% prepare the list of builtin fcts and set their paths 64 menu_str={'PLOT';'FFT';'filter_band';'histogram'}; %list of functions included by default in 'get_field.m' 63 %% prepare the list of RUN fcts and set their paths 64 % functions included by default in 'get_field.m 65 menu_str={'PLOT';'FFT';'filter_band';'histogram'}; 65 66 nb_builtin=numel(menu_str); 66 67 path_uvmat=fileparts(which('uvmat'));%path of the function 'uvmat' … … 78 79 rmpath(fullfile(path_uvmat,'get_field')) 79 80 dir_perso=prefdir; 81 82 % look for functions previously used (names and paths saved in the personal file uvmat_perso.mat): 80 83 profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); 81 84 if exist(profil_perso,'file') 82 % menu={'RUN';'raw2phys';'histogram';'FFT';'peaklocking'};83 85 h=load (profil_perso); 84 86 if isfield(h,'get_field_fct') && iscell(h.get_field_fct) … … 99 101 end 100 102 end 103 101 104 menu_str=menu_str(testexist==1);%=menu_str(testexist~=0) 102 105 fct_handle=fct_handle(testexist==1); … … 110 113 if exist('filename','var') && ischar(filename) %transfer input file name in slave mode 111 114 set(handles.inputfile,'String',filename)% prefill the input file name 112 set(handles.inputfile,'Enable','off')% desactivate the input file edit box 113 % set(handles.list_fig,'Value',2)% plotting axes =uvmat selected 114 % set(handles.list_fig,'Visible','off')% 115 set(handles.RUN,'String','REFRESH')% passive mode, get_field used to define the field for uvamt 116 set(handles.MenuOpen,'Visible','off') 117 set(handles.MenuExport,'Visible','off') 118 set(handles.MenuHelp,'Visible','off') 119 inputfile_Callback(hObject, eventdata, handles) 115 Field=nc2struct(filename);% reads the whole field 116 if isfield(Field,'Txt') 117 msgbox_uvmat('ERROR',Field.Txt) 118 else 119 set(handles.figure1,'UserData',Field); 120 Field_input(eventdata,handles,Field); 121 end 120 122 else %master mode 121 123 set(handles.inputfile,'String','') 122 set(handles.RUN,'String','RUN')%124 % set(handles.RUN,'String','RUN')% 123 125 % load the list of previously browsed files for the upper bar menu Open 124 126 dir_perso=prefdir; … … 143 145 end 144 146 end 145 %transfer input field in slave mode 146 if exist('Field','var') && isstruct(Field) 147 Field_input(eventdata,handles,Field) 148 % if exist('haxes','var') 149 % 'TESTget' 150 % get(haxes,'Tag') 151 % Field.PlotAxes=haxes; 152 % end 153 set(hObject,'UserData',Field); 154 end 155 147 148 %% remove already opened get_field GUI with name get_field 149 if ~(exist('multiple','var') && isequal(multiple,1)) %set single occurrence 150 hget_field=findobj(allchild(0),'Name','get_field'); %hget_field(1)= new GUI 151 if length(hget_field)>1 152 delete(hget_field(2)) 153 end 154 else 155 set(hObject,'name','get_field_1') 156 end 156 157 157 158 … … 163 164 164 165 %------------------------------------------------------------------------ 165 % --- Executes on button press in browse. 166 function browse_Callback(hObject, eventdata, handles) 167 %------------------------------------------------------------------------ 168 169 %------------------------------------------------------------------------ 166 % --- Executes when a new input file name is introduced. 170 167 function inputfile_Callback(hObject, eventdata, handles) 171 168 %------------------------------------------------------------------------ … … 178 175 Field_input(eventdata,handles,Field); 179 176 end 180 181 %------------------------------------------------------------------------ 177 huvmat=findobj(allchild(0),'tag','uvmat'); 178 if ~isempty(huvmat) 179 delete(huvmat)%delete uvmat for plot reinitialisation 180 end 181 182 %------------------------------------------------------------------------ 183 % --- update the display when a new field is introduced. 182 184 function Field_input(eventdata,handles,Field) 183 185 %------------------------------------------------------------------------ … … 256 258 set(handles.coord_y_scalar,'Value',VarType{imax}.coord_y+1) 257 259 end 260 if ~isempty(VarType{imax}.coord_z) 261 set(handles.coord_z_scalar,'Value',VarType{imax}.coord_z+1) 262 end 258 263 if ~isempty(VarType{imax}.coord) 259 set(handles.coord_y_scalar,'Value',VarType{imax}.coord(1)+1) 260 if numel(VarType{imax}.coord)>=2 261 set(handles.coord_x_scalar,'Value',VarType{imax}.coord(2)+1) 264 if numel(VarType{imax}.coord)>=maxdim-2 265 set(handles.coord_z_scalar,'Value',VarType{imax}.coord(maxdim-2)+1) 262 266 end 267 if numel(VarType{imax}.coord)>=maxdim-1 268 set(handles.coord_y_scalar,'Value',VarType{imax}.coord(maxdim-1)+1) 269 end 270 if numel(VarType{imax}.coord)>=maxdim 271 set(handles.coord_x_scalar,'Value',VarType{imax}.coord(maxdim)+1) 272 end 263 273 end 264 274 end … … 272 282 function ordinate_Callback(hObject, eventdata, handles) 273 283 %------------------------------------------------------------------------ 274 %update_field(hObject, eventdata, handles)275 % A REVOIR276 284 hselect_field=get(handles.inputfile,'parent'); 277 285 Field=get(hselect_field,'UserData'); 278 % xindex=get(handles.abscissa,'Value');279 286 list=get(handles.ordinate,'String'); 280 287 yindex=get(handles.ordinate,'Value'); … … 298 305 coord_x_index=coord_x_index(coord_x_index~=0); 299 306 set(handles.abscissa,'String',[{''}; (Field.ListVarName(coord_x_index))'; (Field.ListVarName(VarIndex))']) 300 % Field.VarIndex.y=yindex;301 % set(hselect_field,'UserData',Field);302 %update_UserData(handles)303 307 304 308 %------------------------------------------------------------------------ … … 794 798 %--------------------------------------------------------- 795 799 % --- Executes on button press in RUN. 800 796 801 function RUN_Callback(hObject, eventdata, handles) 797 802 %--------------------------------------------------------- … … 799 804 index=get(handles.list_fig,'value'); 800 805 figstring=figcell{index}; 806 807 % plot requested in uvmat 801 808 if isequal(figstring,'uvmat') 809 inputfile=get(handles.inputfile,'String'); 802 810 huvmat=findobj(allchild(0),'tag','uvmat'); 803 hhuvmat=guidata(huvmat); 804 uvmat('run0_Callback',hObject,eventdata,hhuvmat); % display field in uvmat 811 if isempty(huvmat) 812 inputfile=get(handles.inputfile,'String'); 813 uvmat(inputfile) 814 else 815 hhuvmat=guidata(huvmat); 816 uvmat('run0_Callback',hObject,eventdata,hhuvmat); % display field in uvmat 817 end 818 819 % other kind of plot 805 820 else 806 huvmat=findobj(allchild(0),'tag','uvmat');807 delete(huvmat)%808 821 index=get(handles.ACTION,'Value'); 809 822 list_func=get(handles.ACTION,'UserData'); … … 1077 1090 set(handles.attributes,'String',Tabchar); 1078 1091 1079 % list_var=get(handles.dimensions,'String');1080 % val=get(handles.dimensions,'Value');1081 1082 1092 % update dimensions; 1083 1093 if isfield(Field,'ListDimName') … … 1109 1119 end 1110 1120 1121 %------------------------------------------------------------------------ 1111 1122 % --- Executes on button press in check_1Dplot. 1112 1123 function check_1Dplot_Callback(hObject, eventdata, handles) 1124 %------------------------------------------------------------------------ 1113 1125 val=get(handles.check_1Dplot,'Value'); 1114 1126 if isequal(val,0) 1115 1127 set(handles.Panel1Dplot,'Visible','off') 1116 % set(handles.scalar,'Visible','off')1117 % set(handles.ordinate,'Max',2.0)%allow multiple ordinate input option1118 % if isequal(get(handles.check_vector,'Value'),0);1119 % set(handles.coord_z_vectors_scalar,'Visible','off')1120 % end1121 1128 else 1122 1129 set(handles.Panel1Dplot,'Visible','on') 1123 % set(handles.scalar,'Visible','on') 1124 % val=get(handles.ordinate,'Value'); 1125 % val=val(1); 1126 % set(handles.ordinate,'Value',val);%suppress multiple ordinates 1127 % set(handles.ordinate,'Max',1.0);%suppress multiple ordinate input option 1128 % set(handles.coord_z_vectors_scalar,'Visible','on') 1129 end 1130 1130 end 1131 1132 %------------------------------------------------------------------------ 1131 1133 % --- Executes on button press in check_scalar. 1132 1134 function check_scalar_Callback(hObject, eventdata, handles) 1135 %------------------------------------------------------------------------ 1133 1136 val=get(handles.check_scalar,'Value'); 1134 1137 if isequal(val,0) … … 1138 1141 end 1139 1142 1140 %--------------------------- 1143 %------------------------------------------------------------------------ 1141 1144 % --- Executes on button press in check_vector. 1142 1145 function check_vector_Callback(hObject, eventdata, handles) 1146 %------------------------------------------------------------------------ 1143 1147 val=get(handles.check_vector,'Value'); 1144 1148 if isequal(val,0) … … 1148 1152 end 1149 1153 1150 %----------------------------- 1154 %------------------------------------------------------------------------ 1151 1155 function mouse_up_gui(ggg,eventdata,handles) 1156 %------------------------------------------------------------------------ 1152 1157 if isequal(get(ggg,'SelectionType'),'alt') 1153 1158 message=''; … … 1164 1169 end 1165 1170 1166 %--------------------------------------------- 1171 %------------------------------------------------------------------------ 1167 1172 % --- Executes on selection change in ACTION. 1173 %------------------------------------------------------------------------ 1168 1174 function ACTION_Callback(hObject, eventdata, handles) 1169 1175 global nb_builtin … … 1175 1181 % add a new function to the menu 1176 1182 if isequal(ACTION,'more...') 1177 % pathfct=fileparts(path_get_field);1178 % browse_name=fullfile(path_get_field,'FIELD_FCT');1179 % if length(list_path)>nb_builtin1180 % browse_name=list_path{end};% initialize browser with the path of the last introduced function1181 % end1182 1183 [FileName, PathName] = uigetfile( ... 1183 1184 {'*.m', ' (*.m)'; … … 1300 1301 end 1301 1302 end 1302 list=[' view_field';list];1303 list=['uvmat';list]; 1303 1304 set(menu_handle,'Value',1) 1304 1305 set(menu_handle,'String',list)
Note: See TracChangeset
for help on using the changeset viewer.