Changeset 521
- Timestamp:
- Aug 18, 2012, 11:17:48 PM (12 years ago)
- Location:
- trunk/src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/calc_field_interp.m
r517 r521 23 23 InputVarList={}; 24 24 if ischar(Operation),Operation={Operation};end 25 check_skipped=zeros(size(Operation)); 26 Operator=cell(size(Operation)); 25 27 for ilist=1:numel(Operation) 26 28 r=regexp(Operation{ilist},'(?<Operator>(^vec|^norm))\((?<UName>.+),(?<VName>.+)\)$','names'); 27 29 if isempty(r) % the operation is the variable 28 if isempty(find(strcmp(Operation{ilist},InputVarList))); 29 InputVarList=[InputVarList Operation{ilist}]; 30 if ~isfield(Data,Operation{ilist}) 31 check_skipped(ilist)=1; 32 else 33 if isempty(find(strcmp(Operation{ilist},InputVarList))); 34 InputVarList=[InputVarList Operation{ilist}];% the variable is added to the list if it is not already in the list 35 end 36 Operator{ilist}=''; 30 37 end 31 Operator{ilist}='';32 38 else 33 UName{ilist}=r.UName; 34 VName{ilist}=r.VName; 35 if isempty(find(strcmp(r.UName,InputVarList))); 36 InputVarList=[InputVarList UName{ilist}]; 39 if ~isfield(Data,r.UName)||~isfield(Data,r.VName) 40 check_skipped(ilist)=1; 41 else 42 UName{ilist}=r.UName; 43 VName{ilist}=r.VName; 44 if isempty(find(strcmp(r.UName,InputVarList))); 45 InputVarList=[InputVarList UName{ilist}]; %the variable is added to the list if it is not already in the list 46 end 47 if isempty(find(strcmp(r.VName,InputVarList))); 48 InputVarList=[InputVarList VName{ilist}]; %the variable is added to the list if it is not already in the list 49 end 50 Operator{ilist}=r.Operator; 37 51 end 38 if isempty(find(strcmp(r.VName,InputVarList)));39 InputVarList=[InputVarList VName{ilist}];40 end41 Operator{ilist}=r.Operator;42 52 end 43 53 end … … 49 59 end 50 60 for ilist=1:numel(Operation) 61 if ~check_skipped(ilist) 51 62 nbvar=numel(ListVarName); 52 63 switch Operator{ilist} … … 63 74 VarAttribute{nbvar+1}.Role='vector_x'; 64 75 VarAttribute{nbvar+2}.Role='vector_y'; 65 % case 'U'66 % VarVal{nbvar+1}=F_u(XI,YI);67 % ListVarName{nbvar+1}='U';68 % VarAttribute{nbvar+1}.Role='scalar';69 % case 'V'70 % VarVal{nbvar+1}=F_v(XI,YI);71 % ListVarName{nbvar+1}='V';72 % VarAttribute{nbvar+1}.Role='scalar';73 76 case 'norm' 74 77 if exist('XI','var') … … 93 96 end 94 97 end 98 end 95 99 end 96 100 % put an error flag to indicate NaN data -
trunk/src/calc_field_tps.m
r515 r521 48 48 switch OperationType 49 49 case 'vec' 50 check_grid=1; 50 51 DataOut.U=zeros(nb_sites,1); 51 52 DataOut.V=zeros(nb_sites,1); -
trunk/src/get_field.m
r517 r521 868 868 % set(handles.RUN,'BackgroundColor',[1 0 0]) 869 869 huvmat=findobj(allchild(0),'tag','uvmat'); 870 hhuvmat=guidata(huvmat); 871 FieldsMenu=get(hhuvmat.Fields,'String'); 872 Fields=FieldsMenu{get(hhuvmat.Fields,'Value')}; 873 check_first=strcmp(Fields,'get_field...'); % =1 if the first field sereis is selected, =0 else 870 874 if ~isempty(huvmat) 871 set(huvmat,'Visible','on')%make uvmat visible (bugs can hide it in some cases)872 hhuvmat=guidata(huvmat);873 875 get_field_GUI=read_GUI(handles.get_field); 874 876 if isfield(get_field_GUI,'PanelVectors') … … 881 883 menu_str=[{['vec(' UName ',' VName ')']};{UName};{VName};{['norm(' UName ',' VName ')']};{'get_field...'}]; 882 884 menu_color=[{''};{UName};{VName};{['norm(' UName ',' VName ')']}]; 883 FieldsMenu=get(hhuvmat.Fields,'String'); 884 Fields=FieldsMenu{get(hhuvmat.Fields,'Value')}; 885 if strcmp(Fields,'get_field...') 885 if check_first 886 886 set(hhuvmat.Fields,'Value',1) 887 887 set(hhuvmat.Fields,'String',menu_str) … … 897 897 end 898 898 set(hhuvmat.ColorScalar,'String',menu_color) 899 elseif isfield(get_field_GUI,'PanelScalar') 900 set(hhuvmat.Coord_x,'value',1) 901 set(hhuvmat.Coord_y,'value',1) 902 set(hhuvmat.Coord_x,'String',{get_field_GUI.PanelScalar.coord_x_scalar}) 903 set(hhuvmat.Coord_y,'String',{get_field_GUI.PanelScalar.coord_y_scalar}) 904 AName=get_field_GUI.PanelScalar.scalar; 905 if check_first 906 menu=get(hhuvmat.Fields,'String'); 907 else 908 menu=get(hhuvmat.Fields_1,'String'); 909 end 910 ind_select=find(strcmp(AName,menu)); 911 if isempty(ind_select) 912 menu=[menu(1:end-1);{AName};{'get_field...'}]; 913 ind_select=numel(menu)-1; 914 end 915 if check_first 916 set(hhuvmat.Fields,'Value',ind_select); 917 set(hhuvmat.Fields,'String',menu); 918 else 919 set(hhuvmat.Fields_1,'Value',ind_select); 920 set(hhuvmat.Fields_1,'String',menu); 921 end 922 end 923 if ~strcmp(get(gcbf,'tag'),'uvmat')%if uvmat is not already active 924 uvmat('run0_Callback',hObject,eventdata,hhuvmat); %refresh uvmat 899 925 end 900 926 end … … 1202 1228 else 1203 1229 set(handles.Panel1Dplot,'Visible','on') 1230 set(handles.PanelScalar,'Visible','off') 1231 set(handles.CheckScalar,'Value',0) 1232 set(handles.PanelVectors,'Visible','off') 1233 set(handles.CheckVector,'Value',0) 1204 1234 end 1205 1235 … … 1212 1242 set(handles.PanelScalar,'Visible','off') 1213 1243 else 1244 set(handles.Panel1Dplot,'Visible','off') 1245 set(handles.CheckPlot1D,'Value',0) 1214 1246 set(handles.PanelScalar,'Visible','on') 1247 set(handles.PanelVectors,'Visible','off') 1248 set(handles.CheckVector,'Value',0) 1215 1249 end 1216 1250 … … 1223 1257 set(handles.PanelVectors,'Visible','off') 1224 1258 else 1259 set(handles.Panel1Dplot,'Visible','off') 1260 set(handles.CheckPlot1D,'Value',0) 1261 set(handles.PanelScalar,'Visible','off') 1262 set(handles.CheckScalar,'Value',0) 1225 1263 set(handles.PanelVectors,'Visible','on') 1226 1264 end -
trunk/src/mouse_down.m
r512 r521 129 129 end 130 130 break 131 131 132 %if the mouse is over a uicontrol, duplicate the display in an editable zoom window 132 133 case 'uicontrol' … … 169 170 set(hObject,'Units','pixels') 170 171 if strcmp(get(hchild,'enable'),'on') 171 set(hchild,'String',output_str) 172 set(hchild,'String',output_str)% fill the parent uicontrol with the sttring edited in the msgbox 172 173 end 173 174 end -
trunk/src/proj_field.m
r517 r521 909 909 910 910 %% mesh sizes DX and DY 911 DX=FieldData.Mesh;912 DY=FieldData.Mesh; %default913 911 if isfield(ObjectData,'DX') && ~isempty(ObjectData.DX) 914 912 DX=abs(ObjectData.DX);%mesh of interpolation points 913 else 914 DX=FieldData.Mesh; 915 915 end 916 916 if isfield(ObjectData,'DY') && ~isempty(ObjectData.DY) 917 917 DY=abs(ObjectData.DY);%mesh of interpolation points 918 else 919 DY=FieldData.Mesh; 918 920 end 919 921 if ~strcmp(ObjectData.ProjMode,'projection') && (DX==0||DY==0) … … 928 930 testYMin=0; 929 931 testYMax=0; 930 XMin=FieldData.XMin;%default 931 XMax=FieldData.XMax;%default 932 YMin=FieldData.YMin;%default 933 YMax=FieldData.YMax;%default 932 934 933 if isfield(ObjectData,'RangeX') 935 934 XMin=min(ObjectData.RangeX); … … 937 936 testXMin=XMax>XMin; 938 937 testXMax=1; 938 else 939 XMin=FieldData.XMin;%default 940 XMax=FieldData.XMax;%default 939 941 end 940 942 if isfield(ObjectData,'RangeY') … … 943 945 testYMin=YMax>YMin; 944 946 testYMax=1; 947 else 948 YMin=FieldData.YMin;%default 949 YMax=FieldData.YMax;%default 945 950 end 946 951 width=0;%default width of the projection band … … 1159 1164 coord_Y=coord_Y(indsel); 1160 1165 end 1161 testFF=0;1162 nbvar=numel(ProjData.ListVarName);1166 % testFF=0; 1167 % nbvar=numel(ProjData.ListVarName); 1163 1168 if isfield(VarType,'vector_x')&&isfield(VarType,'vector_y')&&~isempty(VarType.vector_x) 1164 1169 VarName_x=FieldData.ListVarName{VarType.vector_x}; … … 1168 1173 FieldData.(VarName_y)=FieldData.(VarName_y)(indsel); 1169 1174 end 1170 FieldVar=cat(2,FieldData.(VarName_x),FieldData.(VarName_y));1175 %FieldVar=cat(2,FieldData.(VarName_x),FieldData.(VarName_y)); 1171 1176 if ~isfield(VarType,'CheckSub') || ~VarType.CheckSub 1172 1177 vector_x_proj=numel(ProjData.ListVarName)+1; … … 1179 1184 FieldData.(VarName_scalar)=FieldData.(VarName_scalar)(indsel); 1180 1185 end 1181 FieldVar=FieldData.(VarName_scalar); 1186 % FieldVar=FieldData.(VarName_scalar); 1187 end 1188 if ~isempty(VarType.ancillary)% do not project ancillary data with interp 1189 FieldData=rmfield(FieldData,FieldData.ListVarName{VarType.ancillary}); 1190 end 1191 if ~isempty(VarType.warnflag)% do not project ancillary data with interp 1192 FieldData=rmfield(FieldData,FieldData.ListVarName{VarType.warnflag}); 1182 1193 end 1183 1194 [VarVal,ListFieldProj,VarAttribute,errormsg]=calc_field_interp([coord_X coord_Y],FieldData,VarType.Operation,XI,YI); -
trunk/src/read_field.m
r520 r521 39 39 % end 40 40 A=[]; 41 if ischar(ParamIn.FieldName) 42 ParamIn.FieldName={ParamIn.FieldName}; 43 end 44 if isfield(ParamIn,'ColorVar') 45 InputField=[ParamIn.FieldName {ParamIn.ColorVar}]; 46 check_colorvar=1; 47 else 48 InputField= ParamIn.FieldName; 49 check_colorvar=0; 50 end 41 51 %% distingush different input file types 42 52 try 43 53 switch FileType 44 54 case 'civdata' 45 % ParamOut.FieldName='velocity';%Civx data found, set .FieldName='velocity' by default 46 % ParamOut.ColorVar='ima_cor'; 47 if isfield(ParamIn,'ColorVar') 48 InputField=[{ParamIn.FieldName} {ParamIn.ColorVar}]; 49 else 50 InputField= {ParamIn.FieldName}; 51 end 52 [Field,ParamOut.VelType,errormsg]=read_civdata(FileName,InputField,ParamIn.VelType); 53 if ~isempty(errormsg),errormsg=['read_civdata:' errormsg];return,end 54 ParamOut.CivStage=Field.CivStage; 55 case 'civx' 55 [Field,ParamOut.VelType,errormsg]=read_civdata(FileName,InputField,ParamIn.VelType); 56 if ~isempty(errormsg),errormsg=['read_civdata:' errormsg];return,end 57 ParamOut.CivStage=Field.CivStage; 58 case 'civx' 56 59 ParamOut.FieldName='velocity';%Civx data found, set .FieldName='velocity' by default 57 % ParamOut.ColorVar='ima_cor'; 58 if isfield(ParamIn,'ColorVar') 59 InputField=[{ParamIn.FieldName} {ParamIn.ColorVar}]; 60 else 61 InputField= {ParamIn.FieldName}; 62 end 63 [Field,ParamOut.VelType]=read_civxdata(FileName,InputField,ParamIn.VelType); 64 if ~isempty(errormsg),errormsg=['read_civxdata:' errormsg];return,end 65 ParamOut.CivStage=Field.CivStage; 60 [Field,ParamOut.VelType]=read_civxdata(FileName,InputField,ParamIn.VelType); 61 if ~isempty(errormsg),errormsg=['read_civxdata:' errormsg];return,end 62 ParamOut.CivStage=Field.CivStage; 66 63 case 'netcdf' 67 r=regexp(ParamIn.FieldName,'(^vec|^norm)\((?<UName>.+),(?<VName>.+)\)$','names'); 68 if isempty(r) 69 ListVar={ParamIn.FieldName}; 70 input='scalar'; 71 else 72 ListVar={r.UName,r.VName}; 73 input='vectors'; 74 end 75 if ~isempty(ParamIn.ColorVar) 76 r=regexp(ParamIn.ColorVar,'(^vec|^norm)\((?<UName>.+),(?<VName>.+)\)$','names'); 64 ListVar={}; 65 for ilist=1:numel(InputField) 66 r=regexp(InputField{ilist},'(?<Operator>(^vec|^norm))\((?<UName>.+),(?<VName>.+)\)$','names'); 77 67 if isempty(r) 78 ListVar=[ListVar {ParamIn.ColorVar}]; 68 ListVar=[ListVar InputField(ilist)]; 69 Role{numel(ListVar)}='scalar'; 70 % FieldRequest{numel(ListVar)}='interp_lin';%scalar field (requires interpolation for plot) 79 71 else 80 72 ListVar=[ListVar {r.UName,r.VName}]; 73 Role{numel(ListVar)}='vector_y'; 74 Role{numel(ListVar)-1}='vector_x'; 75 % switch r.Operator 76 % case 'norm' 77 % FieldRequest{numel(ListVar)-1}='interp_lin';%scalar field (requires interpolation for plot) 78 % FieldRequest{numel(ListVar)}='interp_lin'; 79 % otherwise 80 % FieldRequest{numel(ListVar)-1}=''; 81 % end 81 82 end 82 83 end 83 [Field,var_detect,ichoice]=nc2struct(FileName,[ParamIn.CoordName ListVar]); 84 if strcmp(input,'vectors') 85 Field.VarAttribute{3}.Role='vector_x'; 86 Field.VarAttribute{4}.Role='vector_y'; 87 else 88 Field.VarAttribute{3}.Role='scalar'; 89 end 90 % GUIName='get_field'; %default name of the GUI get_field 91 % if isfield(ParamIn,'GUIName') 92 % GUIName=ParamIn.GUIName; 93 % end 94 % CivStage=0; 95 % % if ~strcmp(ParamIn.FieldName,'get_field...')% if get_field is not requested, look for Civx data 96 % FieldList=calc_field;%list of possible fields for Civx data 97 % ParamOut.ColorVar='';%default 98 % if ischar(ParamIn.FieldName) 99 % FieldName=ParamIn.FieldName; 100 % else 101 % FieldName=ParamIn.FieldName{1}; 102 % end 103 % field_index=strcmp(FieldName,FieldList);%look for ParamIn.FieldName in the list of possible fields for Civx data 104 % if isempty(find(field_index,1))% ParamIn.FieldName is not in the list, check whether Civx data exist 105 % Data=nc2struct(FileName,'ListGlobalAttribute','Conventions','absolut_time_T0','civ','CivStage'); 106 % % case of new civdata conventions 107 % if isequal(Data.Conventions,'uvmat/civdata') 108 % 109 % %case of old civx conventions 110 % elseif ~isempty(Data.absolut_time_T0)&& ~isequal(Data.civ,0) 111 % ParamOut.FieldName='velocity';%Civx data found, set .FieldName='velocity' by default 112 % ParamOut.ColorVar='ima_cor'; 113 % InputField=[{ParamOut.FieldName} {ParamOut.ColorVar}]; 114 % [Field,ParamOut.VelType]=read_civxdata(FileName,InputField,ParamIn.VelType); 115 % if ~isempty(errormsg),errormsg=['read_civxdata:' errormsg];return,end 116 % CivStage=Field.CivStage; 117 % ParamOut.CivStage=Field.CivStage; 118 % % not cvix file, fields will be chosen through the GUI get_field 119 % else 120 % ParamOut.FieldName='get_field...'; 121 % hget_field=findobj(allchild(0),'Name',GUIName);%find the get_field... GUI 122 % if ~isempty(hget_field) 123 % delete(hget_field)%delete get_field for reinitialisation 124 % end 125 % end 126 % else 127 % InputField=ParamOut.FieldName; 128 % if ischar(InputField) 129 % InputField={InputField}; 130 % end 131 % if isfield(ParamIn,'ColorVar') 132 % ParamOut.ColorVar=ParamIn.ColorVar; 133 % InputField=[InputField {ParamOut.ColorVar}]; 134 % end 135 % [Field,ParamOut.VelType,errormsg]=read_civxdata(FileName,InputField,ParamIn.VelType); 136 % if ~isempty(errormsg),errormsg=['read_civxdata:' errormsg];return,end 137 % CivStage=Field.CivStage; 138 % ParamOut.CivStage=Field.CivStage; 139 % end 140 % ParamOut.FieldList=[{'image'};FieldList;{'get_field...'}]; 141 % end 142 % if CivStage==0% read the field names on the interface get_field. 143 % hget_field=findobj(allchild(0),'Name',GUIName);%find the get_field... GUI 144 % if isempty(hget_field)% open the GUI get_field if it is not found 145 % hget_field= get_field(FileName);%open the get_field GUI 146 % set(hget_field,'Name',GUIName)%update the name of get_field (e.g. get_field_1) 147 % end 148 % hhget_field=guidata(hget_field); 149 % %% update the get_field GUI 150 % set(hhget_field.inputfile,'String',FileName) 151 % set(hhget_field.list_fig,'Value',1) 152 % if exist('num','var')&&~isnan(num) 153 % set(hhget_field.TimeIndexValue,'String',num2str(num)) 154 % end 155 % % funct_list=get(hhget_field.ACTION,'UserData'); 156 % % funct_index=get(hhget_field.ACTION,'Value'); 157 % % funct=funct_list{funct_index};%select the current action in get_field, e;g. PLOT 158 % % Field=funct(hget_field); %%activate the current action selected in get_field, e;g.read the names of the variables to plot 159 % [Field,errormsg]=read_get_field(hget_field); 160 % Tabchar={''};%default 161 % Tabcell=[]; 162 % set(hhget_field.inputfile,'String',FileName) 163 % if isfield(Field,'ListGlobalAttribute')&& ~isempty(Field.ListGlobalAttribute) 164 % for iline=1:length(Field.ListGlobalAttribute) 165 % Tabcell{iline,1}=Field.ListGlobalAttribute{iline}; 166 % if isfield(Field, Field.ListGlobalAttribute{iline}) 167 % val=Field.(Field.ListGlobalAttribute{iline}); 168 % if ischar(val); 169 % Tabcell{iline,2}=val; 170 % else 171 % Tabcell{iline,2}=num2str(val); 172 % end 173 % end 174 % end 175 % if ~isempty(Tabcell) 176 % Tabchar=cell2tab(Tabcell,'='); 177 % Tabchar=[{''};Tabchar]; 178 % end 179 % end 180 % ParamOut.CivStage=0; 181 % ParamOut.VelType=[]; 182 % if isfield(Field,'TimeIndex') 183 % ParamOut.TimeIndex=Field.TimeIndex; 184 % end 185 % if isfield(Field,'TimeValue') 186 % ParamOut.TimeValue=Field.TimeValue; 187 % end 188 % ParamOut.FieldList={'get_field...'}; 189 84 if check_colorvar 85 Role{numel(ListVar)}='ancillary';% scalar used for color vector (not projected) 86 end 87 [Field,var_detect,ichoice]=nc2struct(FileName,[ParamIn.CoordName ListVar]); 88 for ivar=1:numel(ListVar) 89 Field.VarAttribute{ivar+2}.Role=Role{ivar}; 90 % Field.VarAttribute{ivar+2}.FieldRequest=FieldRequest{ivar}; 91 end 92 % GUIName='get_field'; %default name of the GUI get_field 93 % if isfield(ParamIn,'GUIName') 94 % GUIName=ParamIn.GUIName; 95 % end 96 % CivStage=0; 97 % % if ~strcmp(ParamIn.FieldName,'get_field...')% if get_field is not requested, look for Civx data 98 % FieldList=calc_field;%list of possible fields for Civx data 99 % ParamOut.ColorVar='';%default 100 % if ischar(ParamIn.FieldName) 101 % FieldName=ParamIn.FieldName; 102 % else 103 % FieldName=ParamIn.FieldName{1}; 104 % end 105 % field_index=strcmp(FieldName,FieldList);%look for ParamIn.FieldName in the list of possible fields for Civx data 106 % if isempty(find(field_index,1))% ParamIn.FieldName is not in the list, check whether Civx data exist 107 % Data=nc2struct(FileName,'ListGlobalAttribute','Conventions','absolut_time_T0','civ','CivStage'); 108 % % case of new civdata conventions 109 % if isequal(Data.Conventions,'uvmat/civdata') 110 % 111 % %case of old civx conventions 112 % elseif ~isempty(Data.absolut_time_T0)&& ~isequal(Data.civ,0) 113 % ParamOut.FieldName='velocity';%Civx data found, set .FieldName='velocity' by default 114 % ParamOut.ColorVar='ima_cor'; 115 % InputField=[{ParamOut.FieldName} {ParamOut.ColorVar}]; 116 % [Field,ParamOut.VelType]=read_civxdata(FileName,InputField,ParamIn.VelType); 117 % if ~isempty(errormsg),errormsg=['read_civxdata:' errormsg];return,end 118 % CivStage=Field.CivStage; 119 % ParamOut.CivStage=Field.CivStage; 120 % % not cvix file, fields will be chosen through the GUI get_field 121 % else 122 % ParamOut.FieldName='get_field...'; 123 % hget_field=findobj(allchild(0),'Name',GUIName);%find the get_field... GUI 124 % if ~isempty(hget_field) 125 % delete(hget_field)%delete get_field for reinitialisation 126 % end 127 % end 128 % else 129 % InputField=ParamOut.FieldName; 130 % if ischar(InputField) 131 % InputField={InputField}; 132 % end 133 % if isfield(ParamIn,'ColorVar') 134 % ParamOut.ColorVar=ParamIn.ColorVar; 135 % InputField=[InputField {ParamOut.ColorVar}]; 136 % end 137 % [Field,ParamOut.VelType,errormsg]=read_civxdata(FileName,InputField,ParamIn.VelType); 138 % if ~isempty(errormsg),errormsg=['read_civxdata:' errormsg];return,end 139 % CivStage=Field.CivStage; 140 % ParamOut.CivStage=Field.CivStage; 141 % end 142 % ParamOut.FieldList=[{'image'};FieldList;{'get_field...'}]; 143 % end 144 % if CivStage==0% read the field names on the interface get_field. 145 % hget_field=findobj(allchild(0),'Name',GUIName);%find the get_field... GUI 146 % if isempty(hget_field)% open the GUI get_field if it is not found 147 % hget_field= get_field(FileName);%open the get_field GUI 148 % set(hget_field,'Name',GUIName)%update the name of get_field (e.g. get_field_1) 149 % end 150 % hhget_field=guidata(hget_field); 151 % %% update the get_field GUI 152 % set(hhget_field.inputfile,'String',FileName) 153 % set(hhget_field.list_fig,'Value',1) 154 % if exist('num','var')&&~isnan(num) 155 % set(hhget_field.TimeIndexValue,'String',num2str(num)) 156 % end 157 % % funct_list=get(hhget_field.ACTION,'UserData'); 158 % % funct_index=get(hhget_field.ACTION,'Value'); 159 % % funct=funct_list{funct_index};%select the current action in get_field, e;g. PLOT 160 % % Field=funct(hget_field); %%activate the current action selected in get_field, e;g.read the names of the variables to plot 161 % [Field,errormsg]=read_get_field(hget_field); 162 % Tabchar={''};%default 163 % Tabcell=[]; 164 % set(hhget_field.inputfile,'String',FileName) 165 % if isfield(Field,'ListGlobalAttribute')&& ~isempty(Field.ListGlobalAttribute) 166 % for iline=1:length(Field.ListGlobalAttribute) 167 % Tabcell{iline,1}=Field.ListGlobalAttribute{iline}; 168 % if isfield(Field, Field.ListGlobalAttribute{iline}) 169 % val=Field.(Field.ListGlobalAttribute{iline}); 170 % if ischar(val); 171 % Tabcell{iline,2}=val; 172 % else 173 % Tabcell{iline,2}=num2str(val); 174 % end 175 % end 176 % end 177 % if ~isempty(Tabcell) 178 % Tabchar=cell2tab(Tabcell,'='); 179 % Tabchar=[{''};Tabchar]; 180 % end 181 % end 182 % ParamOut.CivStage=0; 183 % ParamOut.VelType=[]; 184 % if isfield(Field,'TimeIndex') 185 % ParamOut.TimeIndex=Field.TimeIndex; 186 % end 187 % if isfield(Field,'TimeValue') 188 % ParamOut.TimeValue=Field.TimeValue; 189 % end 190 % ParamOut.FieldList={'get_field...'}; 191 190 192 case 'video' 191 193 if strcmp(class(ParamIn),'VideoReader') -
trunk/src/series.m
r512 r521 587 587 set(handles.OutputSubDir,'String',SubDirOut) 588 588 589 %% display the min and max indices for all the file series 590 i_sum=sum(sum(i1_series,2),1);%sum of i1_series on the last index 591 MaxIndex_i=max(find(i_sum>0))-1;% max ref index i 592 MinIndex_i=min(find(i_sum>0))-1;% min ref index i 593 i2_min=[]; 594 if ~isempty(i2_series) 595 i2_min=i2_series(1,2,2); 596 end 597 j1_min=[]; 598 if ~isempty(j1_series) 599 j1_min=j1_series(1,2,2); 600 end 601 j2_min=[]; 602 if ~isempty(j2_series) 603 j2_min=j2_series(1,2,2); 604 end 605 if isequal(MinIndex_i,1) &&... 606 exist (fullfile_uvmat(InputTable{iview,1},InputTable{iview,2},InputTable{iview,3},InputTable{iview,5},InputTable{iview,4},0,i2_min, j1_min,j2_min),'file') 607 MinIndex_i=0; 608 end 609 j_sum=sum(sum(j1_series,1),1); 610 MaxIndex_j=max(find(j_sum>0))-1; 611 MinIndex_j=min(find(j_sum>0))-1; 589 %% display the min and max indices for the file series 590 pair_max=squeeze(max(i1_series,[],1)); %max on pair index 591 j_max=max(pair_max,[],1); 592 %i_sum=sum(sum(i1_series,2),1);%sum of i1_series on the last index 593 MaxIndex_i=max(find(j_max))-1;% max ref index i 594 MinIndex_i=min(find(j_max))-1;% min ref index i 595 i_max=max(pair_max,[],2); 596 MaxIndex_j=max(find(i_max))-1;% max ref index i 597 MinIndex_j=min(find(i_max))-1;% min ref index i 598 % i2_min=[]; 599 % if ~isempty(i2_series) 600 % i2_min=i2_series(1,2,2); 601 % end 602 % j1_min=[]; 603 % if ~isempty(j1_series) 604 % j1_min=j1_series(1,2,2); 605 % end 606 % j2_min=[]; 607 % if ~isempty(j2_series) 608 % j2_min=j2_series(1,2,2); 609 % end 610 % if isequal(MinIndex_i,1) &&... 611 % exist (fullfile_uvmat(InputTable{iview,1},InputTable{iview,2},InputTable{iview,3},InputTable{iview,5},InputTable{iview,4},0,i2_min, j1_min,j2_min),'file') 612 % MinIndex_i=0; 613 % end 614 % j_sum=sum(sum(j1_series,1),1); 615 % MaxIndex_j=max(find(j_sum>0))-1; 616 % MinIndex_j=min(find(j_sum>0))-1; 612 617 MinIndex=get(handles.MinIndex,'Data');%retrieve the min indices in the table MinIndex 613 618 MaxIndex=get(handles.MaxIndex,'Data');%retrieve the max indices in the table MaxIndex … … 777 782 set(handles.series,'UserData',SeriesData) 778 783 779 %% enable j index visibility 784 %% enable j index visibilitycellfun(@isempty,regexp(PairString,'^j')) 780 785 state='off'; 781 786 check_jindex=~cellfun(@isempty,SeriesData.j1_series); %look for non empty j indices … … 783 788 enable_j(handles,'off') % no j index needed 784 789 else 785 enable_j(handles,'on') 790 PairString=get(handles.PairString,'Data'); 791 if isempty(find(cellfun(@isempty,regexp(PairString,'^j'))))% if all pair string begins by j (burst) 792 enable_j(handles,'off') % no j index needed 793 else 794 enable_j(handles,'on') 795 end 786 796 end 787 797 … … 1154 1164 function update_mode(handles,i1_series,i2_series,j1_series,j2_series,time) 1155 1165 %------------------------------------------------------------------------ 1156 check_burst=0;1157 if isempty(j2_series)% no pair menu to display1166 % check_burst=0; 1167 if isempty(j2_series)% no j pair 1158 1168 if isempty(i2_series) 1159 set(handles.mode,'String',{''}) 1169 set(handles.mode,'Value',1) 1170 set(handles.mode,'String',{''})% no pair menu to display 1171 else 1172 set(handles.mode,'Value',1) 1173 set(handles.mode,'String',{'series(Di)'}) % pair menu with only option Di 1174 end 1175 else %existence of j pairs 1176 pair_max=squeeze(max(i1_series,[],1)); %max on pair index 1177 j_max=max(pair_max,[],1); 1178 MaxIndex_i=max(find(j_max))-1;% max ref index i 1179 MinIndex_i=min(find(j_max))-1;% min ref index i 1180 i_max=max(pair_max,[],2); 1181 MaxIndex_j=max(find(i_max))-1;% max ref index i 1182 MinIndex_j=min(find(i_max))-1;% min ref index i 1183 if MaxIndex_j==MinIndex_j 1184 set(handles.mode,'Value',1); 1185 set(handles.mode,'String',{'bursts'}) 1186 % check_burst=1; 1187 elseif MaxIndex_i==MinIndex_i 1188 set(handles.mode,'Value',1); 1189 set(handles.mode,'String',{'series(Dj)'}) 1160 1190 else 1161 set(handles.mode,'Value',1) 1162 set(handles.mode,'String',{'series(Di)'}) 1163 end 1164 else 1165 nbfield=size(j2_series,1); 1166 nbfield2=size(j2_series,2); 1167 set(handles.mode,'String',{'bursts';'series(Dj)'}) 1168 if nbfield2>10 || nbfield==1 1169 set(handles.mode,'Value',2);%set mode to series(Dj) if more than 10 j values 1170 else 1171 set(handles.mode,'Value',1); 1172 check_burst=1; 1173 end 1174 end 1175 if check_burst 1176 enable_i(handles,'On') 1177 enable_j(handles,'Off') %do not display j index scanning in burst mode (j is fixed by the burst choice) 1178 else 1179 enable_i(handles,'On') 1180 if isempty(j1_series) 1181 enable_j(handles,'Off') 1182 else 1183 enable_j(handles,'On') 1184 end 1185 end 1191 set(handles.mode,'String',{'bursts';'series(Dj)'}) 1192 if (MaxIndex_j-MinIndex_j)>10 1193 set(handles.mode,'Value',2);%set mode to series(Dj) if more than 10 j values 1194 else 1195 set(handles.mode,'Value',1); 1196 % check_burst=1; 1197 end 1198 end 1199 end 1200 % if check_burst 1201 % enable_i(handles,'On') 1202 % enable_j(handles,'Off') %do not display j index scanning in burst mode (j is fixed by the burst choice) 1203 % else 1204 % enable_i(handles,'On') 1205 % if isempty(j1_series) 1206 % enable_j(handles,'Off') 1207 % else 1208 % enable_j(handles,'On') 1209 % end 1210 % end 1186 1211 fill_ListPair(handles,i1_series,i2_series,j1_series,j2_series,time) 1187 1212 ListPairs_Callback([],[],handles) -
trunk/src/uvmat.m
r520 r521 999 999 set(handles.ColorScalar,'Value',1) 1000 1000 set(handles.ColorScalar,'String',ColorList) 1001 set(handles.Vectors,'Visible','on') 1001 1002 set(handles.Coord_x,'Value',1); 1002 1003 set(handles.Coord_x,'String',{'X'}); … … 1992 1993 1993 1994 %% determine the main input file information for action 1994 % UvData.FileType{1}=[];%default1995 1995 if ~exist(FileName,'file') 1996 1996 errormsg=['input file ' FileName ' does not exist']; … … 2091 2091 [Field{1},ParamOut,errormsg] = read_field(FileName,UvData.FileType{1},ParamIn,frame_index); 2092 2092 if ~isempty(errormsg) 2093 errormsg=[' error in reading' FileName ': ' errormsg];2093 errormsg=['uvmat/refresh_field/read_field: ' FileName ': ' errormsg]; 2094 2094 return 2095 2095 end
Note: See TracChangeset
for help on using the changeset viewer.