Date: Jan 17, 2013 2:08 PM
Author: ulas
Subject: Re: character array writing to a netcdf

Hi when i do that, i get the same funny output in a transposed way, there seems to be a problem reading the names in the putvar function?


TideMan <mulgor@gmail.com> wrote in message <94cb79c0-f83d-4851-a148-09c80a6def29@googlegroups.com>...
> 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.