0001 function nc_type = gmt_get_nctype3(variable)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 str = struct('logical','BYTE','int8','BYTE',...
0013 'int16' ,'SHORT',...
0014 'int32' ,'INT',...
0015 'single','FLOAT',...
0016 'double','DOUBLE',...
0017 'int64' ,'INT64');
0018
0019 notsupported={'uint8','uint16','uint32','uint64'};
0020
0021 assert(~ismember(class(variable),notsupported),['atmlab:' mfilename ''],...
0022 'data type: ''%s'' is not supported by netcdf3',class(variable))
0023
0024 if isfield(str,class(variable))
0025 nc_type = str.(class(variable));
0026 else
0027 error(sprintf('gmtlab:%s:input',mfilename),...
0028 'Class %s has no corresponding netcdf type',class(variable))
0029 end
0030