%% Take File out of Define Mode  
% When you create a file using |netcdf.create|, the functions opens the
% file in define mode. This example uses |netcdf.endDef| to take the file
% out of define mode.   

%% 
% Create a netCDF file. 
ncid = netcdf.create('foo.c','NC_NOCLOBBER');  

%% 
% Define a dimension. 
dimid = netcdf.defDim(ncid,'lat',50);  

%% 
% Leave define mode. 
netcdf.endDef(ncid)  

%% 
% Making a change, when not in define mode, will return an error. For this
% example the define mode was ended, using the |netcdf.endDef| function,
% therefore typing |dimid = netcdf.defDim(ncid,'lon',50)| in the command
% window should return an error.








%% 
% Copyright 2012 The MathWorks, Inc.