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
1
vote
0 answers

How to repair corrupted .mat file after it was recovered by using recovery software

I was at the middle of a project and accidentally deleted one of my major folder which contains all my signals. All of the signals was in .mat format and each of them has considerably large size. After taking my laptop to support center, they…
maia
  • 302
  • 1
  • 4
  • 12
1
vote
1 answer

How to save Sift feature vector for classification using Neural network

Matlab implementation of SIFT features were found from http://www.cs.ubc.ca/~lowe/keypoints/. with the help of stackoverflow. I want to save features to a .mat file. Features are roundness, color, no of white pixel count in the binary image and sift…
1
vote
1 answer

No closing of `matfile` connection?

The matfile command opens what seems like a persistent connection to a *.mat file. In most coding situations where a file is accessed, it is necessary to close said file. There is no mention of that in the page linked to above. It seems unusual…
user36800
  • 2,019
  • 2
  • 19
  • 34
1
vote
2 answers

Loading a MAT file without creating an intermediate variable

I am trying to load a MAT file and getting a dataset as an output. If I run a = load('foo.mat'); a is a structure and not a dataset. In order to get a dataset I need to run the following code load('foo.mat'); a = foo; Though, in this way in my…
federico
  • 65
  • 1
  • 6
1
vote
0 answers

Created ndarray from a .mat file, but how to format for a pandas dataframe?

I am loading data from a MATLAB .mat file into python. The .mat file has a number of cells, and within each cell is a struct with several named fields: samp = 1x2 cell array {1×1 struct} {1×1 struct} samp{1}.buttonID = 3 samp{1}.buttonName =…
j45612
  • 362
  • 1
  • 5
  • 17
1
vote
1 answer

Loading multiple .mat files into a matrix and performing operations on it

I have 429 numerical matrices of identical size (107 rows by 36 columns), stored inside sequentially named .mat files (e.g: subj_00000.mat ... subj_00428.mat). Here's what I need to do: Import into the MATLAB workspace. After importing, average…
1
vote
1 answer

Loading huge cell array containing structures

I have an issue with saving and loading a huge dataset in Matlab. My dataset contains properties of series of images using Matlab's regionprops. I currently have a MAT-file of about 21GB and this takes a while to load. This MAT-file has one cell…
1
vote
1 answer

make tensorflow dataset from huge number of images(*.jpg) and labels(*.mat)

I have a huge number of images with their labels (.mat) file (cannot use tf.data.Dataset.from_tensor_slices()) and I want to use tf.data API to make a tensorflow dataset out of it. As I read in the documentation, I can use tf.data.TextLineDataset…
Cna
  • 147
  • 2
  • 9
1
vote
1 answer

How to get numeric value(Decimals) from a string name

I currently have a list of mat files labeled from P0.01.mat- P10.mat and would like to get numeric value of the selected .mat file. what i have currently gives me just from P1.mat to P10.mat. When i run this for a string of P0.01.mat its returns the…
dejioni
  • 37
  • 6
1
vote
1 answer

How to convert a numpy.ndarray type into a list?

I want to read a matfile in python and then export the data in a database. in order to do this I need to have the data type as list in python. I wrote the code below: import scipy.io as si import csv a = si.loadmat('matfilename') b = a['variable'] …
Mohsen
  • 25
  • 4
1
vote
2 answers

How can I convert complex .mat file to csv using python

I am trying to convert a .mat file to csv using python. The code I am using is import scipy.io import numpy as np data = scipy.io.loadmat("wiki.mat") for i in data: if '__' not in i and 'readme' not in i: …
Gaurav
  • 103
  • 1
  • 11
1
vote
1 answer

Append data to a saved variable using matfile()

I have some random 2D data fuffa that I save to a file fuffalo: fuffa=rand(10,10); save('fuffalo','fuffa', '-v7.3') I then go through a loop that generates other fuffa data that I want to append (in the third dimension) to the saved variable. To do…
shamalaia
  • 2,282
  • 3
  • 23
  • 35
1
vote
0 answers

Unseekable HTTP Response

I am accessing some .mat files hosted on a SimpleHTTP server and trying to load them using Python's loadmat: from scipy.io import loadmat import requests r = requests.get(requestURL,stream=True) print loadmat(r.raw) However, I am getting an…
cinabars
  • 11
  • 3
1
vote
1 answer

How can I rename variables from a saved workspace?

How can the variable "var", included in a MAT-file, be loaded under a different name? I have a few MAT-files which include a variable whose name is always the same, but the value is of course different. I want to load them through a loop without…
Peter
  • 71
  • 6
1
vote
1 answer

Armadillo reading MAT file error

I'm currently cross-compiling on the BeagleBone Black in a Visual Studio environment using Armadillo to translate MATLAB code into C++. This is a signal processing project, so I need a way to read and write binary data files, specifically .mat…