| Contents | Index |
datum = cdflib.getVarData(cdfId,varNum,recNum,indices)
datum = cdflib.getVarData(cdfId,varNum,recNum,indices) returns a single value from a variable in a Common Data Format (CDF) file.
datum |
Value of the specified record. |
Open the example CDF file and retrieve data associated with a variable:
cdfid = cdflib.open('example.cdf');
% Determine how many variables are in the file.
info = cdflib.inquire(cdfid);
info.numVars
ans =
5
% Determine if the first variable has dimensions.
varinfo = cdflib.inquireVar(cdfid,0);
vardims = varinfo.dims
vardims =
[]
% Get data from variable, without specifying dimensions.
datum = cdflib.getVarData(cdfid, varnum, recnum)
datum =
6.3146e+013
% Get dimensions of another variable in file.
varinfo = cdflib.inquireVar(cdfid,3);
vardims = varinfo.dims
vardims =
[4 2 2]
% Retrieve the first datum in the record. Indices are zero-based.
datum = cdflib.getVarData(cdfId,3,0,[0 0 0])
info =
30
% Clean up.
cdflib.close(cdfid);
clear cdfidThis function corresponds to the CDF library C API routine CDFgetzVarData. To use these functions, you must be familiar with the CDF C interface. Read the CDF documentation at the CDF Web site. For copyright information, see the cdfcopyright.txt file.
cdflib.getVarRecordData | cdflib.hyperGetVarData | cdflib.putVarData

Explore how to use MATLAB to make advancements in engineering and science.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |