Documentation

This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

我们为许可用户提供了部分翻译好的中文文档。您只需登录便可查阅这些文档

H5R.create

Create reference

Syntax

ref = H5R.create(loc_id,name,ref_type,space_id)

Description

ref = H5R.create(loc_id,name,ref_type,space_id) creates the reference, ref, of the type specified in ref_type, pointing to the object specified by name located at loc_id. The ref_type argument can be either 'H5R_OBJECT', or 'H5R_DATASET_REGION'. The space_id argument should be -1, if ref_type is 'H5R_OBJECT'.

Examples

Create a double-precision dataset and a reference dataset.

fid = H5F.create('myfile.h5');
type1_id = H5T.copy('H5T_NATIVE_DOUBLE');
dims = [10 5];
h5_dims = fliplr(dims);
h5_maxdims = h5_dims;
space1_id = H5S.create_simple(2,h5_dims,h5_maxdims);
dcpl = 'H5P_DEFAULT';
dset1_id = H5D.create(fid,'my_double',type1_id,space1_id,dcpl);
type2_id = 'H5T_STD_REF_OBJ';
space2_id = H5S.create('H5S_SCALAR');
dset2_id = H5D.create(fid,'my_ref',type2_id,space2_id,dcpl);
ref_data = H5R.create(fid,'my_double','H5R_OBJECT',-1);
dxpl = 'H5P_DEFAULT';
H5D.write(dset2_id,'H5ML_DEFAULT','H5S_ALL','H5S_ALL',dxpl,ref_data);
H5D.close(dset1_id);
H5D.close(dset2_id);
H5F.close(fid);

See Also

Was this topic helpful?