How to save "char" datatype column data into the NetCDF file along with "int32", "single", and ''double" datatype column data?

2 vues (au cours des 30 derniers jours)
I have "int32", "single", ''double" and "char" datatype of column data in the attached mat format file (26.8 kb). I want to save all the data into a NetCDF file without changing the size of other variables. But I am getting errors until I am not making the size equal to the variable. Can someone tell me how to put the following four variables into ncfile?
load('gdp_hourly_velocities_f86e_04a9_23f1.mat')
ld1=gdp_hourly_velocities.drogue_lost_date;
lt1=gdp_hourly_velocities.latitude;
rw1=gdp_hourly_velocities.rowsize;
st1=gdp_hourly_velocities.DeploymentStatus;
nccreate('ncfile.nc','ld1','Dimensions',{'ld1',1,size(ld1,1)},'Datatype','double');
ncwrite('ncfile.nc','ld1',ld1);
nccreate('ncfile.nc','lt1','Dimensions',{'lt1',1,size(lt1,1)},'Datatype','single');
ncwrite('ncfile.nc','lt1',lt1);
nccreate('ncfile.nc','rw1','Dimensions',{'rw1',1,size(rw1,1)},'Datatype','int32');
ncwrite('ncfile.nc','rw1',rw1);
nccreate('ncfile.nc','st1','Dimensions',{'st1',4,size(st1,1)},'Datatype','char');
ncwrite('ncfile.nc','st1',st1);

Réponses (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by