Reading Matlab

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Reading Matlab

Mathieu Dubois
Hello,

I wanted to use Octave to read a .mat file. The file format is version
7.3 i.e. HDF5 which I think is correct (I have opened it using python).
To my surprise, octave don't seem able to read it:

octave:3> load nyu_depth_v2_labeled.mat

warning: load: can't read `keys' (unknown datatype)

HDF5-DIAG: Error detected in HDF5 (1.8.4-patch1) thread 140297714808640:

   #000: ../../../src/H5Dio.c line 174 in H5Dread(): can't read data

     major: Dataset

     minor: Read failed

<lot of other error messages>

octave:4> load -v7 nyu_depth_v2_labeled.mat

warning: load: found version 2 binary MAT file, but only prepared for version 1

error: load: invalid element type = 0

error: load: trouble reading binary file `nyu_depth_v2_labeled.mat'


Is there any way to read that type of files?

I'm using Octave 3.6.1 under Ubuntu 12.04.

Thanks in advance,
Mathieu
_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Reading Matlab

vinukn
Did you tried in new versions of octave, ie 3.6.2, 3.6.3 or 3.7.1+
Reply | Threaded
Open this post in threaded view
|

Re: Reading Matlab

Jordi Gutiérrez Hermoso-2
On 22 February 2013 11:22, vinukn <[hidden email]> wrote:
> Did you tried in new versions of octave, ie 3.6.2, 3.6.3 or 3.7.1+

Don't try 3.7.1+ unless you're interested in participating in Octave
development. It's a development snapshot.

- Jordi G. H.
_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Reading Matlab v7.3 mat file

Mathieu Dubois
Hi,

I have compiled and installed 3.6.4 and I have the same errors.
octave:1> load  nyu_depth_v2_labeled.mat
warning: load: can't read 'keys' (unknown datatype)
HDF5-DIAG: Error detected in HDF5 (1.8.4-patch1) thread 140677001172800:
  #000: ../../../src/H5Dio.c line 174 in H5Dread(): can't read data
    major: Dataset
    minor: Read failed
so on>

Any idea? A quick googling in the error message suggest that this may be related to variable length strings (the mat file contains cell arrays of strings).

Mathieu

----- Mail original -----

> De: "Jordi Gutiérrez Hermoso" <[hidden email]>
> À: "vinukn" <[hidden email]>
> Cc: [hidden email]
> Envoyé: Vendredi 22 Février 2013 17:28:17
> Objet: Re: Reading Matlab
>
> On 22 February 2013 11:22, vinukn <[hidden email]> wrote:
> > Did you tried in new versions of octave, ie 3.6.2, 3.6.3 or 3.7.1+
>
> Don't try 3.7.1+ unless you're interested in participating in Octave
> development. It's a development snapshot.
>
> - Jordi G. H.
> _______________________________________________
> Help-octave mailing list
> [hidden email]
> https://mailman.cae.wisc.edu/listinfo/help-octave
>
_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Reading Matlab v7.3 mat file

Mathieu Dubois
I have looked at the code in src/ls-hdf5.cc. The first problem(can't
read 'keys') seems to appear at line 526. The value of the type_class_id
is unknown: it is neither H5T_FLOAT, H5T_INTEGER,  H5T_STRING, H5T_COMPOUND.

Printing it reveal that it has value 7 which according to HDF library
headers (H5Tpublic.h) means: H5T_REFERENCE.

For information I have Ubuntu 12.04 on a 64 bits system. Lib HDF5 is
version 1.8.4-patch1. I have compiled octave without any option to
configure.

Mathieu

Le 22/02/2013 19:31, Mathieu Dubois a écrit :

> Hi,
>
> I have compiled and installed 3.6.4 and I have the same errors.
> octave:1> load  nyu_depth_v2_labeled.mat
> warning: load: can't read 'keys' (unknown datatype)
> HDF5-DIAG: Error detected in HDF5 (1.8.4-patch1) thread 140677001172800:
>    #000: ../../../src/H5Dio.c line 174 in H5Dread(): can't read data
>      major: Dataset
>      minor: Read failed
> so on>
>
> Any idea? A quick googling in the error message suggest that this may be related to variable length strings (the mat file contains cell arrays of strings).
>
> Mathieu
>
> ----- Mail original -----
>> De: "Jordi Gutiérrez Hermoso" <[hidden email]>
>> À: "vinukn" <[hidden email]>
>> Cc: [hidden email]
>> Envoyé: Vendredi 22 Février 2013 17:28:17
>> Objet: Re: Reading Matlab
>>
>> On 22 February 2013 11:22, vinukn <[hidden email]> wrote:
>>> Did you tried in new versions of octave, ie 3.6.2, 3.6.3 or 3.7.1+
>> Don't try 3.7.1+ unless you're interested in participating in Octave
>> development. It's a development snapshot.
>>
>> - Jordi G. H.
>> _______________________________________________
>> Help-octave mailing list
>> [hidden email]
>> https://mailman.cae.wisc.edu/listinfo/help-octave
>>
> _______________________________________________
> Help-octave mailing list
> [hidden email]
> https://mailman.cae.wisc.edu/listinfo/help-octave

_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Reading Matlab v7.3 mat file

Mathieu Dubois
Rethinking about it I wanted to re-ask the initial question: can octave
read matlab v7.3 files with the load command?

 From the documentation, octave can read and write in HDF5 files but I
think that it uses it's own format (it's nowhere specified that it is
compatible with matlab).

The mat v7.3 format is based on HDF5 but I think that they use special
conventions to encode their data. So it would not be surprising that it
is somehow different than octave's one (just guessing).

Implementing that functionality (it if isn't) would be nice and all the
building blocks are available.

Mathieu

Le 23/02/2013 00:06, Mathieu Dubois a écrit :

> I have looked at the code in src/ls-hdf5.cc. The first problem(can't
> read 'keys') seems to appear at line 526. The value of the
> type_class_id is unknown: it is neither H5T_FLOAT, H5T_INTEGER,  
> H5T_STRING, H5T_COMPOUND.
>
> Printing it reveal that it has value 7 which according to HDF library
> headers (H5Tpublic.h) means: H5T_REFERENCE.
>
> For information I have Ubuntu 12.04 on a 64 bits system. Lib HDF5 is
> version 1.8.4-patch1. I have compiled octave without any option to
> configure.
>
> Mathieu
>
> Le 22/02/2013 19:31, Mathieu Dubois a écrit :
>> Hi,
>>
>> I have compiled and installed 3.6.4 and I have the same errors.
>> octave:1> load  nyu_depth_v2_labeled.mat
>> warning: load: can't read 'keys' (unknown datatype)
>> HDF5-DIAG: Error detected in HDF5 (1.8.4-patch1) thread 140677001172800:
>>    #000: ../../../src/H5Dio.c line 174 in H5Dread(): can't read data
>>      major: Dataset
>>      minor: Read failed
>> so on>
>>
>> Any idea? A quick googling in the error message suggest that this may
>> be related to variable length strings (the mat file contains cell
>> arrays of strings).
>>
>> Mathieu
>>
>> ----- Mail original -----
>>> De: "Jordi Gutiérrez Hermoso" <[hidden email]>
>>> À: "vinukn" <[hidden email]>
>>> Cc: [hidden email]
>>> Envoyé: Vendredi 22 Février 2013 17:28:17
>>> Objet: Re: Reading Matlab
>>>
>>> On 22 February 2013 11:22, vinukn <[hidden email]> wrote:
>>>> Did you tried in new versions of octave, ie 3.6.2, 3.6.3 or 3.7.1+
>>> Don't try 3.7.1+ unless you're interested in participating in Octave
>>> development. It's a development snapshot.
>>>
>>> - Jordi G. H.
>>> _______________________________________________
>>> Help-octave mailing list
>>> [hidden email]
>>> https://mailman.cae.wisc.edu/listinfo/help-octave
>>>
>> _______________________________________________
>> Help-octave mailing list
>> [hidden email]
>> https://mailman.cae.wisc.edu/listinfo/help-octave
>
> _______________________________________________
> Help-octave mailing list
> [hidden email]
> https://mailman.cae.wisc.edu/listinfo/help-octave

_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Reading Matlab v7.3 mat file

vinukn
In reply to this post by Mathieu Dubois
Please report a bug.
Reply | Threaded
Open this post in threaded view
|

Re: Re: Reading Matlab v7.3 mat file

John W. Eaton
Administrator
In reply to this post by Mathieu Dubois
On 02/22/2013 06:06 PM, Mathieu Dubois wrote:

> I have looked at the code in src/ls-hdf5.cc. The first problem(can't
> read 'keys') seems to appear at line 526. The value of the type_class_id
> is unknown: it is neither H5T_FLOAT, H5T_INTEGER, H5T_STRING, H5T_COMPOUND.
>
> Printing it reveal that it has value 7 which according to HDF library
> headers (H5Tpublic.h) means: H5T_REFERENCE.
>
> For information I have Ubuntu 12.04 on a 64 bits system. Lib HDF5 is
> version 1.8.4-patch1. I have compiled octave without any option to
> configure.

The code in Octave for handling HDF5 files was written long before
Matlab's save function was changed to create HDF5 files, and is only
intended to read HDF5 files that Octave itself creates.

Are you interested in contributing code to support Matlab's new HDF5
save format?  If so, let's discuss your plans on the maintainers list.

jwe

_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Reading Matlab v7.3 mat file

Mathieu Dubois
Le 23/02/2013 05:22, John W. Eaton a écrit :

> On 02/22/2013 06:06 PM, Mathieu Dubois wrote:
>> I have looked at the code in src/ls-hdf5.cc. The first problem(can't
>> read 'keys') seems to appear at line 526. The value of the type_class_id
>> is unknown: it is neither H5T_FLOAT, H5T_INTEGER, H5T_STRING,
>> H5T_COMPOUND.
>>
>> Printing it reveal that it has value 7 which according to HDF library
>> headers (H5Tpublic.h) means: H5T_REFERENCE.
>>
>> For information I have Ubuntu 12.04 on a 64 bits system. Lib HDF5 is
>> version 1.8.4-patch1. I have compiled octave without any option to
>> configure.
>
> The code in Octave for handling HDF5 files was written long before
> Matlab's save function was changed to create HDF5 files, and is only
> intended to read HDF5 files that Octave itself creates.
>
> Are you interested in contributing code to support Matlab's new HDF5
> save format?  If so, let's discuss your plans on the maintainers list.
I have think about it this week-end but I clearly don't have the time
now. However that could be a cool project so I will re-consider it in 1
month or so.

In the meantime I can take some time to read: is there any document
explaining how to add IO format to octave?

Mathieu

>
> jwe
>
> _______________________________________________
> Help-octave mailing list
> [hidden email]
> https://mailman.cae.wisc.edu/listinfo/help-octave

_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave