Questions tagged [mat-file]

Use with questions about .mat files. These files are used for storing MATLAB variables.

MAT-file is binary file format, used to store data in multiple variables or structures in MATLAB. These files use the .mat extension, and can be accessed in using the load, save or matfile functions. For more information, see MAT-File Versions in the MATLAB documentation.

MAT-files can be also created and read by other programming languages such as Python etc.

Refer to this PDF document for a description of the internals of the MAT-file format (Level 4 and Level 5).

218 questions
2
votes
3 answers

How to save .mat file contents in memory in MATLAB?

I want to get the byte array of a .mat file of a specific matrix. How can I do that? I can save a matrix on disk by this command: save('a.mat', 'a') Now, I do not want to save the .mat file on disk. Instead, I want it in memory to send it over a…
Ali Mirzaei
  • 1,496
  • 2
  • 16
  • 27
2
votes
1 answer

partial load of matlab (.mat) files -v7 in python

I have a large set of matlab files data files which I need to access in Python. The files were saved using save with -v6 or -v7 option, but not the -v7.3. I have to read only one single numerical value from each file, the files are many (100k+) and…
00__00__00
  • 4,834
  • 9
  • 41
  • 89
2
votes
1 answer

How do I view a .mat file in either MATLAB or the Unix shell?

I just want to view the contents of the file. It's in a directory, which I have access to. Is there a Unix command to view the contents of it? I can also load it in MATLAB. Is there a similar MATLAB command? Thanks
Josh
  • 21
  • 1
  • 1
  • 2
2
votes
1 answer

Matfile isn't loading the structure's field names

Background I encountered some strange behaviour with the function "matfile" in Matlab 2016b - not sure what's going on, and I can't replicate it or create a test case. I have a structure, which I saved to a server, like…
user5128199
2
votes
1 answer

Reading Variable from .mat file in C++

I am making a program in which, I am doing some processing in Matlab and then saving the result in a .mat file using the following command in Matlab, save data x; let's suppose the value of x=2, Now I am reading the same data.mat file from the C++…
nabeel
  • 159
  • 2
  • 3
  • 13
2
votes
1 answer

Differences between encoding of char and uint16 in .mat v7.3 files

I am trying to read v7.3 matlab .mat in python files using h5py. I am encountering a problem where the representations of character arrays (e.g., typically, .mat fields containing a single string), and uint16 arrays, appear identical. >> ushortarr =…
aestrivex
  • 5,170
  • 2
  • 27
  • 44
2
votes
2 answers

Read Mat Files in C++ in a Qt project

I am trying to read a mat-file in an own mat_file_read.cpp in a Qt project, and I am having problems. My error: error lnk2019: unresolved external symbol matOpen referenced in function "int __cdecl read_mat_file(class QString)"…
Arritmic
  • 474
  • 2
  • 12
2
votes
0 answers

Compiled Matlab mat file corruption

I have a compiled application which cannot properly save some user defined objects. When I try to load the mat file in the program it crashes with an Access Violation error. The mat file cannot be loaded in Matlab either (appears to be corrupt).…
2
votes
1 answer

Reading a MatLab (mat) file with VNL

I've been given a .mat file (three dimensions, single precision floating point), which I'd like to read using VXL. VNL has a few classes/functions for doing this, but I've not found any examples demonstrating their use. I've pieced the following…
sudo make install
  • 5,629
  • 3
  • 36
  • 48
2
votes
1 answer

How can I automate analyzing matrices stored in a mat file?

I've got a multidimensional .mat file with a bunch of m x n arrays where each one is called something different, for example f1, f2, etc. I want to open the .mat file up and analyze each file automatically. How do I do that?
2
votes
1 answer

How to access the "Value" in a .mat file without knowing the name?

I need to load in a .mat file and extract the data. The .mat file will always store one variable with a "Name" and a "Value": 'name' <1024x1280x20 uint8> (for example) To access the data, I currently have to know the variable name, so I do something…
Sean Sen Wang
  • 193
  • 1
  • 1
  • 12
2
votes
2 answers

How to append in .mat file row or columnwise cellmatrix

I am running a simulation where i generate huge 2d sparse matrices and hence i use FIND function to only store nonzero values with their indices. Now for each iteration of for loop i generate such matrix and because they are all of different length…
nitin
  • 175
  • 1
  • 10
2
votes
1 answer

Loading huge binary file partially into Matlab

I have a huge binary file with double precision numbers and I would like to load parts of it into Matlab. Is there a way to do this? One way would be if I could convert it to a .mat file (without loading it in Matlab first), but I haven't been able…
jorgen
  • 3,425
  • 4
  • 31
  • 53
2
votes
1 answer

Exporting a Scipy sparse matrix from Python2.7 to Matlab?

I have a very large Scipy sparse (csr) matrix. I can't use M.toarray() since it triggers ValueError: array is too big. Is there a way of saving a Scipy sparse matrix in Python to be read in Matlab? I need some tools that are available in Matlab.
user2179347
  • 155
  • 4
  • 13
2
votes
1 answer

Reading data of a mat file in visual c++ by MatIO

I want to read a mat file in visual C++ by matI/o library. I add #include to headers and add folder of headers to VC++ Directories>include dir . My mat file (opt.mat) has a structure that its field are some matrices. I want to read data of…
user2855778
  • 137
  • 3
  • 19