|
From: dan n. <dne...@ya...> - 2019-08-23 23:39:28
|
Hi Marc,
I just wanted to clear up this issue. It is possible, in fact, to save a dataObject in an hdf5 formated file and read it in Octave. There is no bug, except ones that existed in my brain, which are now fixed.
I originally did two things incorrectly. First, I created an hdf5 file with hpf5.file, called hf. I then used hf to create the dataset. However, I supplied a dataObject, d, to the hf.create_dataset call (i.e., hf.create_dataset('dataset_1',data=d). This created an erroneous hdf5 file. When I converted the dataObject to a numpy array (nd=np.array(d), where numpy was imported as np) and supplied that to hf.create_dataset, i.e., hf.create_dataset('dataset_1',data=nd), I was able to view the file's contents using hdfviewer (an app I loaded onto my centos7 system to test the validity of hdf5 files).
The second thing I did incorrectly was to assume when I loaded the file in Octave, it would be an Octave matrix. In fact, after poking around a bit using Google, it is loaded as an Octave structure. Once I understood that, I copied the matrix held in one of the structure's elements ("dataset_1") into an Octave matrix and it worked fine.
So, it is possible to move dataObjects from itom to Octave matrices using hdf5.
Regards,
Dan |