How can I write a variable which datatype is a string in netcdf file
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Ricardo Duarte
am 24 Mai 2020
Kommentiert: Ricardo Duarte
am 25 Mai 2020
Hello, Im new using Netcdf files.
I need to write a variable which is a string in a netcdf file.
I tryied this:
nccreate(file_name,'/dataset_ambient_noise/calibration/calibration_procedure','datatype','char','Dimensions',{'hydrophone_count',hydrophone_count}); %to create the variable calibration_procedure
and then I used ncwrite to write the variable:
ncwrite(file_name,'/dataset_ambient_noise/calibration/calibration_procedure',calibration_procedure);
calibration_procedure is equal to a string (no matter what).
When I do this I get the error:
"The NetCDF library encountered an error during execution of 'putVaraText' function - 'Start+count exceeds dimension bound (NC_EEDGE)'."
Does anyone here can help me??
Thanks in advance.
0 Kommentare
Akzeptierte Antwort
per isakson
am 24 Mai 2020
Most likely, the space you specified for the variable calibration_procedure in the nc-file, i.e.
'Dimensions',{'hydrophone_count',hydrophone_count}
is too small to store the value of the Matlab variable calibration_procedure
That is
length( calibration_procedure ) > hydrophone_count
is true
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu NetCDF finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!