%javaaddpath('C:\Users\mahtab\TU %Delft\checkout\OpenEarthTools\io\nctools\toolsUI-2.2.22.jar') % define the directory where the raw files are stored datadir=fullfile('..','raw'); load(fullfile(datadir,'infinity_processed')); % check how many columns we have npoints = length(infinity.sdate); % this is the file we're saving results to filename=('offshore_data.nc'); nam={'sea level';'Hm0';'Tp';'m0';'Hs';'Hm';'H_10';'H_max';'T_mean';'T_s'}; unn={'m';'m';'1/s';'m';'m';'m';'m';'m';'1/s';'1/s'}; snam={'sea level';'Significant wave height-Hm0';'Peak wave period-Tp';'m0';'Significant wave height-Hs';'Hm';'H_10';'H_max';'T_mean';'T_s'}; nc_create_empty(filename) %by using the command length(lat_variable) it shows an error! nc_add_dimension(filename,'records',npoints) varstruct.Name='x'; varstruct.Nctype=nc_double; varstruct.Dimension={'records'}; nc_addvar(filename,varstruct) nc_attput(filename,'x','units','m') nc_attput(filename, 'x', 'standard_name', 'projection_x_coordinate') % there is an error here too!nc_attput(filename,'title','Converting bathymetry data to NETcdf file') nc_varput(filename, 'elevation', elev) nc_varput(filename, 'x', x) nc_varput(filename, 'y', y) nc_dump(filename)