Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: character array writing to a netcdf
Replies: 2   Last Post: Jan 17, 2013 2:08 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
ulas

Posts: 13
From: istanbul
Registered: 7/17/08
Re: character array writing to a netcdf
Posted: Jan 17, 2013 2:08 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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.




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.