This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.


Synchronize netCDF file to disk




netcdf.sync(ncid) synchronizes the state of a netCDF file to disk. The netCDF library normally buffers accesses to the underlying netCDF file, unless you specify the NC_SHARE mode when you opened the file with or netcdf.create. To call netcdf.sync, the netCDF file must be in data mode.

This function corresponds to the nc_sync function in the netCDF library C API. To use this function, you should be familiar with the netCDF programming paradigm. See netcdf for more information.


This example creates a new netCDF file for write access, performs an operation on the file, takes the file out of define mode, and then synchronizes the file to disk.

% Create a netCDF file.
ncid = netcdf.create('','NC_WRITE');

% Perform an operation.
dimid = netcdf.defDim(ncid,'Xdim',50);

% Take file out of define mode.

% Synchronize the file to disk.
Was this topic helpful?