Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
2024.1.0 - English


h5dataset

Create a dataset and write the data

Syntax

h5dataset(obj, name, sourceInfo [, sourceType], data, targetInfo [, targetType])
h5dataset(filename, name, sourceInfo [, sourceType], data, targetInfo [, targetType])

Arguments

obj

a H5Object

name

a string giving the path to the new dataset

sourceInfo

a matrix 5xn of doubles

sourceType

a string giving the type of the source

data

a Scilab data

targetInfo

a matrix 6xn of doubles

targetType

a string giving the type of the target

filename

a string giving the filename

Description

Create a new named dataset (if it does not exist) based on the Scilab data passed as argument.

The target HDF5 type can be chosen in the list available in the HDF5 manual. Examples of this HDF5 type are "H5T_MIPS_U32" or "H5T_STD_B64BE", but shortcuts as "MIPS_U32" or "STD_B64BE" can also be used.

The source info gives information on how to get the data. It is a matrix 5xn where n is the number of dimensions of the data. The rows give the following information:

  • 1st row: the data dimensions.
  • 2nd row: the start point of the hyperslab.
  • 3rd row: the hyperslab's count.
  • 4th row: the hyperslab's stride.
  • 5th row: the hyperslab's block.

For more explanation about hyperslab selection, see h5write.

The targetInfo matrix is 6xn double matrix. The first row gives the dimensions of the target dataset and the second one gives the maximal possible dimensions. When the first and the second row are not equal, the dataset will be chunked. The rows 3 to 6 give the hyperslab's start, count, stride and block.

Examples

// We create a new HDF5 file
a = h5open(TMPDIR + "/test.h5", "w")

// The data
x = uint32(1:100);
y = uint32(1:9);

// We create the dataset
// x is viewed as a C-matrix (row-major)
h5dataset(a, "My_Dataset", [10 10 ; 2 1 ; 4 1 ; 2 1 ; 1 9], x, [7 12 ; 9 14 ; 3 3 ; 1 1 ; 1 1 ; 4 9])
h5dump(a, "My_Dataset");

// We add y data in extending the dataset dimensions
h5dataset(a, "My_Dataset", [9 1 ; 1 1 ; 1 1 ; 1 1 ; 9 1], y, [9 12 ; 9 14 ; 1 1 ; 1 1 ; 1 1 ; 9 1])
h5dump(a, "My_Dataset");

// We can replace the y data
h5dataset(a, "My_Dataset", [9 1 ; 1 1 ; 1 1 ; 1 1 ; 9 1], uint32(11:19), [9 12 ; 9 14 ; 1 1 ; 1 1 ; 1 1 ; 9 1])
h5dump(a, "My_Dataset");

// Free all the resources
h5close(a)

See also

  • h5group — Create a group
  • h5attr — Create an attribute
  • h5write — Create a dataset (if it does not exist) and write the data
  • h5writeattr — Write an attribute in a group or a dataset

History

VersionDescription
5.5.0 HDF5 module introduced.
Report an issue
<< h5cp HDF5 files h5dump >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Mon Jun 17 17:49:16 CEST 2024