Hi!
Could you please suggest correct version for Export in “Real32” format?
It doesn’t work
Export["test.h5", RandomReal[1, {5, 5, 5}], {"Real32", "DataFormat"}]
Hi!
Could you please suggest correct version for Export in “Real32” format?
It doesn’t work
Export["test.h5", RandomReal[1, {5, 5, 5}], {"Real32", "DataFormat"}]
Export[“test.h5”, RandomReal[1, {5, 5, 5}], “Real32”]
thanks, it works to export but then for Import it is getting 1D array instead of 3D
In[163]:= Dimensions[Import["test.h5", "Real32"]]
Out[163]= {125}
Can it be proper?
Binary files (“Real32” format) just store data as a concatenation of numbers, just 0s and 1s after each other, there is no dimensional data, units, et cetera. If you want HDF5 format you can do so like this:
Export["real32.h5", {"Datasets" -> {"/data" -> RandomReal[{0, 10}, {10, 10}]}, "DataFormat" -> {"Real32"}}, "Rules"]
and import again:
Import["real32.h5", "Data"]
I would never find this solution. It deserve to be in the tutorial.
Thank a lot! Best regards to Romain Volk and Mickaël Bourgoin ![]()
Under Import and Export of the HDF5 documentation page it says:
Export[“file.h5”,{Subscript[elem, 1]->Subscript[expr, 1],Subscript[elem, 2]->Subscript[expr, 2],[Ellipsis]},“Rules”] uses rules to specify the elements to be exported.
But there is no example of that, and ‘expr’ and ‘elem’ are not clear what they are, so there is room for improvement.