-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
reading MAT files #805
Comments
For v7.3 files, they are in an HDF5 format. We might also look into cribbing notes from SciPy. |
I was not aware it was HDF5. That's nice, actually, although it is a massively over-engineered format. |
Well, that only buys you compatibility with v7.3 files, which I'm still not sure they've made the default. It's much faster as you save larger files, though, and it's your only option for 2+ GB files. I will also point out that the ability to read/save MATLAB files is important for dealing with customers who use MATLAB, or who might require it as an output format. We've dealt with both. |
We can use libmatio that octave uses. |
That looks like it can handle both file types as long as HDF5 support is available elsewhere and has a pretty straightforward C interface. |
Right - we can quickly get matio support. The need had not come up before, but I always figured we could do it at a moment's notice if necessary. I had used it a few years back, and seems like development has continued. -viral On 06-May-2012, at 7:19 PM, pao wrote:
|
For older MAT files, https://github.com/simonster/MAT.jl |
Cool, thanks! Would be good to list it here: https://github.com/JuliaLang/METADATA.jl |
Very nice, Simon! |
This is awesome! |
Probably the module I'm going to use the most in the foreseeable future. Thank you very much, @simonster. :) |
@simonster, do you have any interest in synchronizing with the interface for the HDF5 MatIO module? That way we could provide a single interface supporting multiple versions of There are really two ways we could go about doing that: either you could extend your functions to support some of the operations in the HDF5 module (e.g., providing separate Out of curiosity, what does |
@timholy, Yes, I think we should definitely standardize on one interface for this. I'm fine with adding a function to read a single variable (or array of variables) out of the file, although I think we do actually want a function to read the entire file at once, for convenience and because it's more efficient if you want all the variables. We should also agree on conventions for how data gets returned from these modules and make sure it is consistent between HDF5 and level 5 files. In level 5 format, the number of dimensions of an array is flexible, but MATLAB always saves two, so scalars are 1x1 arrays, empty vectors are 0x0 arrays, column vectors are nx1 arrays, and row vectors are 1xn arrays. I load 1x1 arrays as scalars and empty vectors as empty in only one dimension, although I leave the latter two cases as-is. I'm not sure how these get handled in HDF5. I check |
We should probably move |
@simonster, sure, reading all the variables would be easy to add. And I think the dimensions may already work out as you say, but indeed we should check. @nolta, I was beginning to wonder about the same thing; right now the ability to read & write .mat files, while a "side-effect" of HDF5 support, might be hard to find. Of course, MAT.jl will require HDF5.jl (I will rename it as such shortly), and so no matter where the file lives users will get both. |
julia> load("src/MAT.jl")
julia> load("matio.jl"); using MatIO
julia> fidh5 = matopen("/home/tim/src/julia-modules/julia_hdf5/matfile.mat", "r")
MatlabHDF5File(16777216,"/home/tim/src/julia-modules/julia_hdf5/matfile.mat",true,false)
julia> fid = matopen("test/array.mat", "r")
Matlabv5File(IOStream(<file test/array.mat>),false,nothing) :-) |
This ability would be tremendously useful for Matlab users who have data already in MAT form.
The text was updated successfully, but these errors were encountered: