initComplexVariable
initialize a complex-valued variable
Declaration
complexVariable = initComplexVariable(name,dimNames,properties,ncType)
Parameters
namename of the variable (a string)dimNamescell array containing the dimension namesproperties(optional)containers.MappropertiesncType
Returns
complexVariablea NetCDFComplexVariable object
Discussion
NetCDF does not directly work with complex variables, so this method manages the hassle of working with the real and imaginary parts separately.
The basic work flow is that you need to first,
initComplexVariablefollowed by either,setVariable, orconcatenateVariableAlongDimensiondepending on whether you have a variable dimension.
ncfile.initComplexVariable('wave-components', {'k','l','j'},containers.Map({'units'},{'m/s'}),'NC_DOUBLE');
ncfile.setVariable('wave-components',myVariable);