Mathematica 9 is now available
Student Support Forum
Student Support Forum: 'Reading and writing HDF5 files' topicStudent Support Forum > General > "Reading and writing HDF5 files"

Help | Reply To Topic
Author Comment/Response
11/19/12 08:32am

I'm having problems while reading/writing HDF5 files.

I have a complex .h5 file that contains many elements. Those elements are arrays of numbers and array of strings. I have the following problems:

- If I try to read array of strings Mathematica can just read the first string of the array.
For example if have the file example.h5 and 1 element is ELM/element1 = {"A","B","C"} and I want to import element1 I write:
elements=Import["example.h5", {"Datasets", "/ELM/element1"}]
What happens is that Mathematica imports to elements only the first strnig that in this case is "A". This doesn't happen when I have an array of numbers.

- If I have an array of string and I want to export to HDF5 file I receive the following error:
Export::type: "String" cannot be exported to the "HDF5" format."
Is there any way to export a list of string to a .h5 file?

- How can I specify the data type when I want to export a variable? In the guide it is mentioned that it is possible by using "DataFormat" but I cannot find a way how to use it.

- If I try to export an array of numbers (let's call it variable) to an h5 file using the following command
I get the following error even if the file test.h5 doesn't even exist.
Export::dtaexist: "Could not append to the file because the dataset "/ELM/element1" already exists

Any help would be really appreciated.


URL: ,
Help | Reply To Topic