%% Write Variable to NetCDF File
% Create a NetCDF file that contains a variable, and then write data to that variable.
% Create a new file  myfile.nc containing a variable named pi.

nccreate('myfile.nc','pi');

% Write a scalar data with no dimensions to the variable pi.

ncwrite('myfile.nc','pi',3.1416);

% Read and display the variable from the file.

valPi = ncread('myfile.nc','pi')

% Copyright 2018 The MathWorks, Inc.