cnv_get: Retrieve a data column from cnv structure by SBE name INPUT: cnv: structure containing data from a Seabird *.cnv file (see also read_sbecnv) theFieldName: character array with the name of the desired data columns. The SBE naming convention is volatile and changes so see the current read_sbecnv for examples of valid strings. OUTPUT: theIndex: the index of the column in the given cnv.data matrix. theData: the column of data in the cnv.data matrix DESCRIPTION: cnv_get retrieves a data column and the index of the data column from a cnv structure. If the given name (theFieldName) is not present in the given cnv structure, empty matrices are returned and an error is thrown. It is up to the caller to check for empty return values and catch the errors.
0001 function [theIndex, theData] = cnv_get(cnv,theFieldName) 0002 % cnv_get: Retrieve a data column from cnv structure by SBE name 0003 % 0004 % INPUT: 0005 % cnv: structure containing data from a Seabird *.cnv file (see also read_sbecnv) 0006 % theFieldName: character array with the name of the desired data columns. The 0007 % SBE naming convention is volatile and changes so see the current read_sbecnv for 0008 % examples of valid strings. 0009 % 0010 % OUTPUT: 0011 % theIndex: the index of the column in the given cnv.data matrix. 0012 % theData: the column of data in the cnv.data matrix 0013 % 0014 % DESCRIPTION: 0015 % cnv_get retrieves a data column and the index of the data column 0016 % from a cnv structure. If the given name (theFieldName) is not present 0017 % in the given cnv structure, empty matrices are returned and an error is thrown. 0018 % It is up to the caller to check for empty return values and catch the errors. 0019 % 0020 0021 % Initialization 0022 idx = []; 0023 data = []; 0024 0025 % First, figure out where the pressure data is in the cnv data matrix 0026 allNames = cnv.names; 0027 idx = strmatch(theFieldName,allNames); 0028 data = cnv.data(idx,:); 0029 0030 if isempty(idx) 0031 throw('Data field was not found') 0032 return 0033 end 0034 0035 if nargout > 0 0036 theIndex = idx; 0037 theData = data; 0038 else 0039 assignin('caller', 'ans', {idx data}) 0040 end 0041 return