Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

data_type in matvar_t has incorrect value #114

Open
rafal-c opened this issue Mar 29, 2019 · 3 comments
Open

data_type in matvar_t has incorrect value #114

rafal-c opened this issue Mar 29, 2019 · 3 comments

Comments

@rafal-c
Copy link

rafal-c commented Mar 29, 2019

Consider a simple MAT file (attached) with a single variable with data type MATRIX (14) and array class INT8.
After calling Mat_VarReadInfo on this variable data_type is equal to 0 (MAT_T_UNKNOWN) and after reading data it is equal to 1 (MAT_T_INT8).
Why isn't it equal to MAT_T_MATRIX which, as you can check in a hex editor, is precisely the value stored in the file?

int8.mat.tar.gz

@tbeu
Copy link
Owner

tbeu commented Apr 2, 2019

Duplicate of https://sourceforge.net/p/matio/discussion/609376/thread/1b6bb464/. Ok to close as wontfix?

@rafal-c
Copy link
Author

rafal-c commented Apr 3, 2019

In my opinion it's not a duplicate. The referenced issue focuses on the fact that Mat_ReadVarInfo doesn't read data_type whereas in this issue I show that even after data_type is populated it has incorrect value. So it seems that right now there is no way in matio to get the original data type of a variable (as stored in the file).
What is the purpose of data_type if not to store the raw value of the Data Type field of a data element? (as the values of enum matio_types suggest)?
I understand that for example for a MAT_T_COMPRESSED variable the actual data type after decompressing is different so maybe in that case Mat_ReadVarInfo could assign MAT_T_COMPRESSED to data_type and then Mat_ReadVar could overwrite this field with the actual data type?

@tbeu
Copy link
Owner

tbeu commented Apr 3, 2019

I do not know actually as I neither designed or implemented it. One purpose is, that the desired data type and the actual data type can differ. Question is, if the desired data type is respected by the data class already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants