Changeset 739 for trunk/src/series
- Timestamp:
- Apr 14, 2014, 11:42:43 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/series/merge_proj.m
r716 r739 57 57 first_j=[]; 58 58 if isfield(Param.IndexRange,'first_j'); first_j=Param.IndexRange.first_j; end 59 last_j=[];60 if isfield(Param.IndexRange,'last_j'); last_j=Param.IndexRange.last_j; end61 59 PairString=''; 62 60 if isfield(Param.IndexRange,'PairString'); PairString=Param.IndexRange.PairString; end … … 132 130 end 133 131 end 132 if NbView >1 && max(cell2mat(CheckImage))>0 && ~isfield(Param,'ProjObject') 133 disp_uvmat('ERROR','projection on a common grid is needed to concatene images: use a Projection Object of type ''plane'' with ProjMode=''interp_lin''',checkrun) 134 return 135 end 134 136 135 137 %% calibration data and timing: read the ImaDoc files … … 225 227 [Data{iview},tild,errormsg] = read_field(filecell{iview,index},FileType{iview},Param.InputFields,frame_index{iview}(index)); 226 228 if ~isempty(errormsg) 227 disp (['ERROR in merge_proj/read_field/' errormsg])229 disp_uvmat(['ERROR in merge_proj/read_field/' errormsg],checkrun) 228 230 return 229 231 end … … 253 255 [Data{iview},errormsg]=proj_field(Data{iview},Param.ProjObject); 254 256 if ~isempty(errormsg) 255 disp (['ERROR in merge_proge/proj_field: ' errormsg])257 disp_uvmat(['ERROR in merge_proge/proj_field: ' errormsg],checkrun) 256 258 return 257 259 end … … 266 268 267 269 %% merge the NbView fields 268 MergeData=merge_field(Data);269 if isfield(MergeData,'Txt')270 disp (MergeData.Txt);270 [MergeData,errormsg]=merge_field(Data); 271 if ~isempty(errormsg) 272 disp_uvmat('ERROR',errormsg,checkrun); 271 273 return 272 274 end … … 361 363 error=struct2nc(OutputFile,MergeData);%save result file 362 364 if isempty(error) 363 disp lay(['output file ' OutputFile ' written'])365 disp(['output file ' OutputFile ' written']) 364 366 else 365 disp lay(error)367 disp(error) 366 368 end 367 369 end … … 371 373 %'merge_field': concatene fields 372 374 %------------------------------------------------------------------------ 373 function MergeData=merge_field(Data)375 function [MergeData,errormsg]=merge_field(Data) 374 376 %% default output 375 377 if isempty(Data)||~iscell(Data) … … 377 379 return 378 380 end 379 error =0;381 errormsg=''; 380 382 MergeData=Data{1};% merged field= first field by default, reproduces the glabal attributes of the first field 381 383 NbView=length(Data); … … 386 388 %% group the variables (fields of 'Data') in cells of variables with the same dimensions 387 389 [CellInfo,NbDim,errormsg]=find_field_cells(Data{1}); 390 if ~isempty(errormsg) 391 return 392 end 388 393 389 394 %LOOP ON GROUPS OF VARIABLES SHARING THE SAME DIMENSIONS … … 417 422 MergeData.(VarName)=Data{1}.(VarName);% correct the field of MergeData 418 423 NbAver=~check_bad;% initiate NbAver: the nbre of good data for each point 419 else 424 elseif size(Data{iview}.(VarName))~=size(MergeData.(VarName)) 425 errormsg='sizes of the input matrices do not agree, need to interpolate on a common grid using a projection object'; 426 return 427 else 420 428 MergeData.(VarName)=MergeData.(VarName) + Data{iview}.(VarName);%add data 421 429 NbAver=NbAver + ~check_bad;% add 1 for good data, 0 else
Note: See TracChangeset
for help on using the changeset viewer.