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
3
votes
3 answers

Fast way to check if variable is in .mat file without loading .mat file? 'who'/'whos' is not faster than loading.. Better options than 'who'?

I have a .mat file named "myfile.mat" that contains a huge varible data and, in some cases, another variable data_info. What is the fastest way to check if that .mat file contains the `data_info' variable? the who or whos commands are not faster…
Anton Rodenhauser
  • 441
  • 1
  • 3
  • 11
3
votes
1 answer

Problems reading MATLAB .mat files with a foreach loop in R

I have over a thousand matlab files that I want to read into R. I use the R.matlab package to read them and I would like to parallel the operation. However, once I call the loop (I am generating a single data set from all the .mat files) I get an…
Felipe Alvarenga
  • 2,572
  • 1
  • 17
  • 36
3
votes
1 answer

How can I load / open / read a matlab file *.mat in java?

My code so far (based on this entry) but it doesn't work: MatFileReader matfilereader = new MatFileReader("C:\\data\\Freebase\\initEmbed.mat"); System.out.println(matfilereader.getData().get(0) + "name:…
user3352632
  • 617
  • 6
  • 18
3
votes
1 answer

How to read .mat files created in windows MATLAB using MAC OS MATLAB

I have a bunch of .mat files that were created on a PC (windows 8.1) using MATLAB 7.10.0 R2010a. I am trying to use MATLAB 7.12.0 2011a on a MAC with Yosemite to open those files and they won't open. Here is how the file is saved on MATLAB 7.10.0…
Veridian
  • 3,531
  • 12
  • 46
  • 80
3
votes
3 answers

How to compare .mat files in matlab with different timestamps

I have two .mat files foo.mat and foo2.mat. They are identical except for the time stamp on them. I use visdiff to check the differences and it says they are the same except their binary. How can I compare .mat files while ignoring the time stamp?…
user758114
  • 354
  • 5
  • 22
3
votes
1 answer

loadmat python memory error

I'm new to Python and I want to import a matlab struct of size 850M to it. I use "loadmat" but I get a memory error: return self._matrix_reader.array_from_header(header, process) File "mio5_utils.pyx", line 624, in…
danseuse
  • 53
  • 1
  • 6
2
votes
2 answers

Benefit of reading data off a mat file as opposed from the database

I've seen some code read large data from mat files instead of doing queries on a database. What are the benefits of doing this as oppose to using a database? Is it possible to easily move the mat file contents into a database and vice versa?
mugetsu
  • 4,228
  • 9
  • 50
  • 79
2
votes
2 answers

matlab to python: get matlab cell array values

I am very new to matlab and python and need to use some values in python from the matlab cell array. I have a cell array of integers that after i execute this line of code and print the result, i get this: a = loadmat('file.mat') print…
user974666
  • 359
  • 1
  • 5
  • 8
2
votes
1 answer

Python to Mat-file: export list of string to ordinar matrix of chars (not a cell-array!)

This code on Python creates cell "STRINGS" in .mat-file: data = {"STRINGS": numpy.empty((0),dtype=numpy.object)} data["STRINGS"] = numpy.append( data["STRINGS"], "Some string" ) scipy.io.savemat( output_mat_file, data ) In matlab I get cell…
Mtr
  • 482
  • 5
  • 19
2
votes
3 answers

Opening big result mat-File raises buffer is too small for requested array

I've successfully finished my week-long Dymola simulation only to find myself unable to load the result mat-File with DyMat. Every time I try to open it with Python and DyMat (https://www.j-raedler.de/projects/dymat/) I get the error: buffer is too…
Phil
  • 624
  • 7
  • 19
2
votes
1 answer

Index elements in specific dimension numpy

I know the title is very general but I don't know of a better way to describe my question. I'm using scipy's io.loadmat to load a Matlab mat file. This mat file originally had some structs in it which I suppose were converted to numpy arrays. The…
vnal
  • 53
  • 7
2
votes
2 answers

How to read .mat output files in JModelica?

To save the time, I'm trying to read the .mat file rather than simulate the model again. I used scipy.io.loadmat but it didn't work well: res = loadmat('ChatteringControl_result.mat') res.keys() ['Aclass', 'dataInfo', 'name', 'data_2', 'data_1',…
CY Ye
  • 23
  • 3
2
votes
1 answer

"Expecting miMATRIX type" error when reading MATLAB MAT-file with SciPy

This is a MATLAB question: the problem is caused by interactions with MATLAB files and Python/numpy. I am tying to write a 3-D array of type uint8 in MATLAB, and then read it in Python using numpy. This is the MATLAB code that creates the…
JB_User
  • 3,117
  • 7
  • 31
  • 51
2
votes
1 answer

What is contained in the "function workspace" field in .mat file?

I'm working with .mat files which are saved at the end of a program. The command is save foo.mat so everything is saved. I'm hoping to determine if the program changes by inspecting the .mat files. I see that from run to run, most of the .mat file…
Robert Dodier
  • 16,905
  • 2
  • 31
  • 48
2
votes
1 answer

save() command in matlab engine for python

I am using MATLAB Engine API for Python https://nl.mathworks.com/help/matlab/matlab-engine-for-python.html I would like to open and save a file. #import and start the engine import matlab.engine eng = matlab.engine.start_matlab() print('Matlab…
00__00__00
  • 4,834
  • 9
  • 41
  • 89