Scilab Home page | Wiki | Bug tracker | Forge | Mailing list archives | ATOMS | File exchange
Please login or create an account
Change language to: English - Français - Português - 日本語

Please note that the recommended version of Scilab is 6.0.0. This page might be outdated.
See the recommended documentation of this function

Справка Scilab >> HDF5 Management > h5write


Create a dataset (if it does not exist) and write the data

Calling Sequence

h5write(obj, name, data [, targetType], [, start, count [, stride [, block]]])
h5write(filename, name, data [, targetType], [, start, count [, stride [, block]]])



a H5Object


a string giving the path to the dataset


a Scilab data


a string giving the type of the target


a row of doubles containing the start of the hyperslab


a row of doubles containing the count of the hyperslab


a row of doubles containing the stride of the hyperslab


a row of doubles containing the block of the hyperslab


a string giving the filename


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.

It is possible to make an hyperslab selection on the data.

The arguments start, count, stride and block must have a size equal to the number of dimensions of the data:

  • start: gives the coordinates in the data where to start the selection.
  • count: gives the number of selected blocks in each dimension.
  • stride: gives the shift between two consecutives blocks in each dimension. Take care that the stride must be greater than the corresponding block dimension.
  • block: gives the block dimensions.
By default stride and block are set to 1 in each dimension.

If the target type is "H5T_STD_REF_OBJ", the data matrix must be a string matrix containing the absolute paths of group or datasets.


x = matrix(1:20, 4, 5);
save(TMPDIR + "/x.sod", "x"); // SOD files are HDF5 ones

// Open the created file
a = h5open(TMPDIR + "/x.sod");

// We want to add a new dataset named "y"
y = uint32(matrix(10:30, 7, 3));
h5write(a, "y", y);

// We add a dataset "z" in using MIPS representation
h5write(a, "z", y, "H5T_MIPS_U32");

// Now we make an hyperslab selection
x = uint32(matrix(1:(11*17), 11, 17));
h5write(a, "t", x, [1 2], [2 4], [5 3], [3 2]);

//Now check that all is ok
x, a("/t").data'

// We have finished so we free all the resources

See Also


5.5.0 HDF5 module introduced.
Scilab Enterprises
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Thu Oct 02 14:01:08 CEST 2014