writehdf5attribute
Writes data to an existing attibute at a given location.
Syntax
writehdf5attribute(filename, attributeName, data)
writehdf5attribute(filename, datasetPath, attributeName, data)
writehdf5attribute(filename, groupPath, attributeName, data)
Inputs
- filename
- Path to the HDF5 file.
- datasetPath/groupPath
- Optional. Fully qualified path of the dataset/group in the file. File is considered as the location if this parameter is not provided.
- data
- Data to write.
Example 1
logical_data = true;
createhdf5attribute('test.h5','logical_data_write',logical_data)
logical_data = false;
writehdf5attribute('test.h5','logical_data_write',logical_data)
number_data=99;
createhdf5dataset('test.h5','/number_dataset_write',number_data)
number_data=9;
createhdf5attribute('test.h5','/number_dataset_write','number_data_attribute',number_data)
number_data=199;
writehdf5attribute('test.h5','/number_dataset_write','number_data_attribute',number_data)
real_matrix_data = [1,2;3,4];
createhdf5group('test.h5','/group8')
createhdf5attribute('test.h5','/group8','matrix_data_attribute',real_matrix_data)
real_matrix_data = [11,22;33,44];
writehdf5attribute('test.h5','/group8','matrix_data_attribute',real_matrix_data)
Example 2
string_data='string attribute';
createhdf5attribute('test.h5','string_data_write',string_data)
string_data='string attribute write';
writehdf5attribute('test.h5','string_data_write',string_data)
Comments
- Only logical, number, string, real matrix, and real ndmatrix are supported.
- Complex data is not supported.
- Compound data is not supported.