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

How can I import ground truth data into Matlab for the training of a (faster) R-CNN?

I have a large, labelled, dataset which I have created and I would like to provide it to Matlab to train an R-CNN (using the faster R-CNN algorithm). How can this be done? The built-in labeller provided by Matlab requires that the user manually load…
David Sackstein
  • 500
  • 1
  • 5
  • 19
0
votes
0 answers

Load .mat file in python

I am working with on a course by coursera, and wanted to try the scripts locally. I got this error: IOError: [Errno 2] No such file or directory: 'datasets/data.mat' The file is in the directory and I can see it from Finder on MAC, however, it's…
philippos
  • 1,142
  • 5
  • 20
  • 41
0
votes
0 answers

Data type mismatch while loading mat files (.mat) using `scipy.io` python

For a {1x1} struct where the field name is of size {5x1 **double**} packed inside a mat-file, when i try to read the data type using dtype: import scipy.io as sio a = sio.loadmat('a.mat') …
0
votes
1 answer

Convert a class to structure and store in a .mat file - MATLAB

I have a class which has some properties that they are objects of other classes, when I convert the class to a struct and check the data, the full information of all properties exist. but after storing it to a .mat file, when I load the data, the…
Someone
  • 163
  • 1
  • 3
  • 13
0
votes
1 answer

open .mat file with python 2.7

i'm looking for an equivalent to this python 3.6 code : import scipy.io as sio file = sio.loadmat('file.mat') data = file['data'] I have to do the same thing in python 2.7, i tryed import h5py f = h5py.File('file.mat') But it doesn't work, do you…
0
votes
1 answer

Loading a .mat file in Python3

I'm trying to load in some .mat files into python. I can't save them another way as they are created for me. I'm trying the following: import numpy as np import matplotlib.pyplot as plt import scipy.io as sio dat = sio.loadmat(Filename) When I…
0
votes
1 answer

Accessing array contents inside .mat file in python

I want to read a .mat file available at http://www.eigenvector.com/data/tablets/index.html. To access the data inside this file, I am trying the follwing: import scipy.io as spio import numpy as np import matplotlib.pyplot as plt mat =…
kaushal
  • 55
  • 1
  • 8
0
votes
0 answers

kernel dies when loading .mat file with scipy

I'm trying to load a .mat dataset using scipy but every time I run it the kernel dies and restarts without loading the file. I tried this using jupyter notebook and spyder and both give the same result the code I used is: import scipy.io as sio …
Ferial Mohammed
  • 153
  • 1
  • 1
  • 7
0
votes
1 answer

Logical Indexing Failing when Matrix is loaded by matfile

I have a matrix that was stored in a .mat file, and was then reloaded in matlab via the function matfile. I also have a logical index, like logical([1 0 1 0]), that I want to apply to the loaded matrix: results = matfile('results.mat'); % id is my…
Guilherme Salomé
  • 1,899
  • 4
  • 19
  • 39
0
votes
1 answer

converting a matlab array (MAT-file) to C++ array

I have a 2-D double-precision array in MATLAB that contains specific data. I want to use this array in c++, so I save the array in a mat-file. I know that MATLAB has some c functions that provide reading mat-file in c++ (matdsgn , matOpen , ...),…
0
votes
0 answers

python not reading file object past 137 bytes?

I am retrieving a .mat file using python requests and trying to read it. I can read it fine using read() with an argument of up to 137, but if I try read(138) or higher, nothing prints and the script ends with no error message. import requests r =…
cinabars
  • 11
  • 3
0
votes
1 answer

Approximate experimental data from multiple cells

I have several cell arrays with probe data from .mat-file. I need to find resonance frequencies and q-factors for each of the 1000 inputs, and then estimate (approximate) them. However, the code below provides only 1 value of fres instead of 1000,…
TheDoctor
  • 105
  • 1
  • 9
0
votes
1 answer

python import .mat file: how to just import one wanted column from a matrix

I have this .mat file D887_ALL.mat and there are several matrices in it, one is called trigger_events and is a 671×2 matrix. I will only use the first column. Can I just import the first column in Python? This is what I can do now, just import the…
Yingqiang Gao
  • 939
  • 4
  • 16
  • 29
0
votes
0 answers

TypeError('Expecting miMATRIX type here, got %d' % mdtype) in Python

I am trying to append data to an existing .mat file in python. See the following code: with open('train_x.mat','ab') as f: scipy.io.savemat(f, {'data':image_data}) After appending is done when I am trying to load the file as: training_x =…
Sonu Patidar
  • 701
  • 1
  • 5
  • 10
0
votes
2 answers

convert struct type to matrix octave

I have a myfile.mat that contains 3000x35 size data. When I load it into a variable as : a = load('myfile.mat') It gives struct of size 1x1 . How can I get exact form as matrix. This is required because I need to change certain column values.
Shyamkkhadka
  • 1,438
  • 4
  • 19
  • 29