|
|
Re: character array writing to a netcdf
Posted:
Jan 17, 2013 1:53 PM
|
|
On Friday, January 18, 2013 3:46:07 AM UTC+13, ulas im wrote: > Dear members > > > > i have the following part of a code where i want to fill a character variable of a netcdf file with a character array. The netcdf file is generated, all the numeric variables are created and filled correctly but the character variable is filled funny. What am i missing? Thanks in advance for any help. > > > > StatNames=char('AM01','AT02','AT05','AT34','AT48','BE01','BE32','BE35','CH01','CH02','CH03','CH04','CH05','CY02','CZ01','CZ03','DE01', ... > > > > fileout=[DirOut,'/emep_',name,'.nc']; > > ncid=netcdf.create(fileout,'NC_WRITE'); > > Ch=netcdf.defDim(ncid,'char',6); > > StName=netcdf.defVar(ncid,'Station_name','char',[Ch StatNo]); > > netcdf.endDef(ncid); > > netcdf.putVar(ncid,StName,StatNames); > > netcdf.close(ncid); > > > > I am getting the following final variable when i check the final netcdf file: > > > > Station_name= > > "AAAAAB", > > "BBCCCC", > > "CCCCDD", > > .....
Try transposing StatNames, use StatNames' in the put statement.
|
|