Thread Subject: writing in HDF5 files

Subject: writing in HDF5 files

From: Robert

Date: 30 Jun, 2011 10:35:24

Message: 1 of 2

Hi Matlab users,

I am making a HDF5 (hierarchical data format) file and I have fields like this: Grid, Results, Time. Every one of them has another fields inside, for example in Grid there are: Bathymetry, Latitude, Longitude. My problem is that I can not write the attributes for the Grid field, don't know why. For latitude, longitude and bathymetry it works perfect, but when I am trying for Grid it gives me an error.
The coding for longitude would be like this:

HDF5pathGrid = '/Grid';
HDF5pathGridLAT = '/Grid/Latitude';
HDF5pathGridLON = '/Grid/Longitude';
HDF5pathGridBATH = '/Grid/Bathymetry';

%** WRITE LON
 
hdf5write(HDF5filename,HDF5pathGridLON,LON,'WriteMode', 'append')

    Maximum=max(max(LON));

    attr.max = Maximum;
    attr_details.Name = 'Maximum';
    attr_details.AttachedTo = HDF5pathGridLON;
    attr_details.AttachType = 'dataset';

hdf5write(HDF5filename,attr_details, attr.max,'WriteMode', 'append')

    Minimum=min(min(LON));

    attr.min = Minimum;
    attr_details.Name = 'Minimum';
    attr_details.AttachedTo = HDF5pathGridLON;
    attr_details.AttachType = 'dataset';

hdf5write(HDF5filename,attr_details, attr.min,'WriteMode', 'append')

    Units='º';

    attr.Units = Units;
    attr_details.Name = 'Units';
    attr_details.AttachedTo = HDF5pathGridLON;
    attr_details.AttachType = 'dataset';

hdf5write(HDF5filename,attr_details, attr.Units,'WriteMode','append')

and it works perfect. But when I replace HDF5pathGridLON with HDF5pathGrid and LON with Grid I get errors. Does anyone knows why?

Robert.

Subject: writing in HDF5 files

From: John

Date: 30 Jun, 2011 20:25:07

Message: 2 of 2

"Robert " <toderascurobert@yahoo.com> wrote in message <iuhjhc$hcp$1@newscl01ah.mathworks.com>...
> Hi Matlab users,
>
> I am making a HDF5 (hierarchical data format) file and I have fields like this: Grid, Results, Time. Every one of them has another fields inside, for example in Grid there are: Bathymetry, Latitude, Longitude. My problem is that I can not write the attributes for the Grid field, don't know why. For latitude, longitude and bathymetry it works perfect, but when I am trying for Grid it gives me an error.
> The coding for longitude would be like this:
>
> HDF5pathGrid = '/Grid';
> HDF5pathGridLAT = '/Grid/Latitude';
> HDF5pathGridLON = '/Grid/Longitude';
> HDF5pathGridBATH = '/Grid/Bathymetry';
>
> %** WRITE LON
>
> hdf5write(HDF5filename,HDF5pathGridLON,LON,'WriteMode', 'append')
>
> Maximum=max(max(LON));
>
> attr.max = Maximum;
> attr_details.Name = 'Maximum';
> attr_details.AttachedTo = HDF5pathGridLON;
> attr_details.AttachType = 'dataset';
>
> hdf5write(HDF5filename,attr_details, attr.max,'WriteMode', 'append')
>
> Minimum=min(min(LON));
>
> attr.min = Minimum;
> attr_details.Name = 'Minimum';
> attr_details.AttachedTo = HDF5pathGridLON;
> attr_details.AttachType = 'dataset';
>
> hdf5write(HDF5filename,attr_details, attr.min,'WriteMode', 'append')
>
> Units='º';
>
> attr.Units = Units;
> attr_details.Name = 'Units';
> attr_details.AttachedTo = HDF5pathGridLON;
> attr_details.AttachType = 'dataset';
>
> hdf5write(HDF5filename,attr_details, attr.Units,'WriteMode','append')
>
> and it works perfect. But when I replace HDF5pathGridLON with HDF5pathGrid and LON with Grid I get errors. Does anyone knows why?
>
> Robert.

Did you change attr_details.AttachType to be 'group'?

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
grid Robert 30 Jun, 2011 06:39:11
hierarchical da... Robert 30 Jun, 2011 06:39:11
longitude Robert 30 Jun, 2011 06:39:11
hdf5 Robert 30 Jun, 2011 06:39:10
rssFeed for this Thread

Contact us at files@mathworks.com