Clear Filters
Clear Filters

How to put a String in a dataset attribute

4 views (last 30 days)
Thomas
Thomas on 12 Mar 2013
Edited: per isakson on 29 Oct 2014
I am currently using this code
dset = single(1);
dset_details.Location = '/metaData';
dset_details.Name = 'stringTest';
attr = 'char';
attr_details.Name = 'Pathtest';
attr_details.AttachedTo = '/metaData/stringTest';
attr_details.AttachType = 'dataset';
hdf5write('C:\withstrings.h5', dset_details, dset ...
, attr_details, attr, 'WriteMode', 'append' );
_____________________________________________________________________
But the problem is that I dont want numeric data but i want to as an example: 'C:\path' into the value.
What kind of datatype do i have to use? Because i have a program that automaticaly gives in the pathname. But when it saves into the h5 file it automatically gives the ASCII code from the path into the data but I don't want it to be ASCII Code i just want the full pathname to be in it as a string value.
No matter what type i use, a single, a double, it always converts into ASCII code, how can i save it to be just a string, just the pathname like: 'c:\path'
Can anyone help me with this?
Thanks.

Answers (1)

Ashish Uthama
Ashish Uthama on 12 Mar 2013
Second example h5d.write doc page shows how to write strings. (using cell arrays)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!