addVariable
Add a real or complex variable to the group.
Declaration
var = addVariable(name,dimNames,value,options)
Parameters
-
name(charstring) Variable name. -
dimNames(cellstring) Dimension names (coordinate dimensions) defining the variable. value(:) Variable data. Omit or pass [] to create metadata without writing data.options.isComplex(logical) Create a complex variable wrapper. Default false.options.shouldWriteImmediately(logical) Write metadata and data to file immediately when possible. Default true.
Returns
var(NetCDFVariable) Created variable object.
Discussion
ncfile.addVariable('fluid-tracer', {'x','y','t'}, myVariableData);
or intializes an variable without setting the data,
ncfile.addVariable('fluid-tracer', {'x','y','t'});