Changeset 472 for trunk/src/read_field.m
- Timestamp:
- Jun 25, 2012, 12:12:24 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/read_field.m
r466 r472 57 57 FieldList=calc_field;%list of possible fields for Civx data 58 58 ParamOut.ColorVar='';%default 59 field_index=strcmp(ParamIn.FieldName,FieldList);%look for ParamIn.FieldName in the list of possible fields for Civx data 59 if ischar(ParamIn.FieldName) 60 FieldName=ParamIn.FieldName; 61 else 62 FieldName=ParamIn.FieldName{1}; 63 end 64 field_index=strcmp(FieldName,FieldList);%look for ParamIn.FieldName in the list of possible fields for Civx data 60 65 if isempty(find(field_index,1))% ParamIn.FieldName is not in the list, check whether Civx data exist 61 66 Data=nc2struct(FileName,'ListGlobalAttribute','Conventions','absolut_time_T0','civ','CivStage'); … … 66 71 InputField=[{ParamOut.FieldName} {ParamOut.ColorVar}]; 67 72 [Field,ParamOut.VelType,errormsg]=read_civdata(FileName,InputField,ParamIn.VelType,Data.CivStage); 73 if ~isempty(errormsg),errormsg=['read_civdata:' errormsg];return,end 68 74 CivStage=Field.CivStage; 69 75 ParamOut.CivStage=Field.CivStage; … … 74 80 InputField=[{ParamOut.FieldName} {ParamOut.ColorVar}]; 75 81 [Field,ParamOut.VelType]=read_civxdata(FileName,InputField,ParamIn.VelType); 82 if ~isempty(errormsg),errormsg=['read_civxdata:' errormsg];return,end 76 83 CivStage=Field.CivStage; 77 84 ParamOut.CivStage=Field.CivStage; … … 84 91 end 85 92 end 86 else 87 InputField={ParamOut.FieldName}; 93 else 94 InputField=ParamOut.FieldName; 95 if ischar(InputField) 96 InputField={InputField}; 97 end 88 98 if isfield(ParamIn,'ColorVar') 89 99 ParamOut.ColorVar=ParamIn.ColorVar; … … 91 101 end 92 102 [Field,ParamOut.VelType,errormsg]=read_civxdata(FileName,InputField,ParamIn.VelType); 93 if ~isempty(errormsg) 94 return 95 end 103 if ~isempty(errormsg),errormsg=['read_civxdata:' errormsg];return,end 96 104 CivStage=Field.CivStage; 97 105 ParamOut.CivStage=Field.CivStage; … … 123 131 Tabcell{iline,1}=Field.ListGlobalAttribute{iline}; 124 132 if isfield(Field, Field.ListGlobalAttribute{iline}) 125 eval(['val=Field.' Field.ListGlobalAttribute{iline} ';'])133 val=Field.(Field.ListGlobalAttribute{iline}); 126 134 if ischar(val); 127 135 Tabcell{iline,2}=val; … … 160 168 end 161 169 catch ME 162 errormsg= ME.message;170 errormsg=[FileType ' input: ' ME.message]; 163 171 return 164 172 end
Note: See TracChangeset
for help on using the changeset viewer.