Changeset 613 for trunk/src/read_civdata.m
- Timestamp:
- Apr 19, 2013, 8:26:15 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/read_civdata.m
r612 r613 2 2 %------------------------------------------------------------------ 3 3 % 4 % function [Field,VelTypeOut]=read_civdata( filename,FieldNames,VelType)4 % function [Field,VelTypeOut]=read_civdata(FileName,FieldNames,VelType) 5 5 % 6 6 % OUTPUT: … … 30 30 % 31 31 % INPUT: 32 % filename: file name (string).32 % FileName: file name (string). 33 33 % FieldNames =cell of field names to get, which can contain the strings: 34 34 % 'ima_cor': image correlation, vec_c or vec2_C … … 45 45 % 'nc2struct': reads a netcdf file 46 46 47 function [Field,VelTypeOut,errormsg]=read_civdata( filename,FieldNames,VelType)47 function [Field,VelTypeOut,errormsg]=read_civdata(FileName,FieldNames,VelType) 48 48 49 49 %% default input … … 60 60 FieldNames=[]; %default 61 61 end 62 Field=[]; 63 VelTypeOut=VelType; 62 64 errormsg=''; 65 if ~exist(FileName,'file') 66 errormsg=['input file ' FileName ' does not exist']; 67 return 68 end 63 69 if ischar(FieldNames), FieldNames={FieldNames}; end; 64 70 ProjModeRequest=''; … … 75 81 76 82 %% reading data 77 Data=nc2struct( filename,'ListGlobalAttribute','CivStage');83 Data=nc2struct(FileName,'ListGlobalAttribute','CivStage'); 78 84 if isfield(Data,'Txt') 79 85 erromsg=['error in read_civdata: ' Data.Txt]; … … 85 91 return 86 92 else 87 [Field,vardetect]=nc2struct( filename,varlist);%read the variables in the netcdf file93 [Field,vardetect]=nc2struct(FileName,varlist);%read the variables in the netcdf file 88 94 end 89 95 if isfield(Field,'Txt') … … 92 98 end 93 99 if vardetect(1)==0 94 errormsg=[ 'requested field not available in ' filename '/' VelType ': need to run patch'];100 errormsg=[ 'requested field not available in ' FileName '/' VelType ': need to run patch']; 95 101 return 96 102 end
Note: See TracChangeset
for help on using the changeset viewer.