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

Matlab API reading .mat file from c++

I am trying to import .mat file for the algorithm developed in C++. I have imported the mat.h and all the related library from "matlabroot\extern\include". I am trying to run the following code but getting "undefined reference failure". Error:…
0
votes
1 answer

Writing data to a .mat file

I am trying to write some data that I extracted from an excel file to a '.mat' file. So far, I have converted the extracted data into an array and converted this array to a dictionary before writing to a .mat file. While the conversions to the array…
MoD
  • 1
  • 1
0
votes
1 answer

Fastest method for loading large dataset into python

I have some relatively large .mat files that I'm reading in to Python to eventually use in PyTorch. These files range in the number of rows (~55k to ~111k), but each has a little under 11k columns, with no header, and all the entries are floats. The…
CopyOfA
  • 767
  • 5
  • 19
0
votes
0 answers

how to read "Cannot display summaries of variables with more than 524288 elements." mat file in Matlab?

I have a problem with reading a large mat file containing 1x27184292 char. I've tried many parsing and reading tools e.g. fileread, fopen, etc. but I couldn't open and read it. Could you please help me with that?
0
votes
1 answer

How to load and run multiple .mat files in matlab

I am trying to run multiple .mat files in matlab. So far i have 3 .mat files each containing the same variables. I want to run one .mat file and then switch to the next file. They are named like this: file2019_1.mat %day 1 …
nico1234
  • 9
  • 8
0
votes
0 answers

Scipy savemat / loadmat - How to preserve 1D arrays vs 2D arrays with length 1 dimensions

Saving and loading using scipy.io.savemat and scipy.io.loadmat does not distinguish between a 1D numpy array and a 2D numpy array with one length 1 dimension. In the example below, how can I get a1 to have the same shape as a, and b1 to have the…
Selvek
  • 130
  • 1
  • 9
0
votes
1 answer

How to load all variables from a .mat file(saved as -v7.3) in python?

I have a .mat file saved as -v7.3 in matlab and contains 1000 variables named x1 to x1000. My objective is to transfer(or load) all these variables into something like X_train which will be used as an input data for an encoder-decoder based neural…
0
votes
1 answer

How to specify the chunksize of large array saved in -v7.3 matfile?

I'm saving large data array to mat file. m = matfile('data.mat','writable',true); m.X(1000,1000,10,50000) = nan(1,'single'); for ii = 1 : 50000 % do some computation m.X(1:1000,1:1000,1:10,ii) = Y; end How can I set ChunkSize of X to…
wsdzbm
  • 3,096
  • 3
  • 25
  • 28
0
votes
0 answers

Is there a way to concatenate matlab arrays with python (e.g. using scipy.io)?

I'm trying to write a large (~ 20GB) .fvp file, which behaves like a delimited text file to a matlab array and save it as a .mat with python 3. Right now, I am reading the file in python, converting the values to a single numpy array and saving it…
ag3nt
  • 1
0
votes
0 answers

Python could not load mat data sucessfully. ValueError: Did not fully consume compressed contents of an miCOMPRESSED element

I have saved spectrograms as mat files in MATLAB. However, when I train a pix2pix model with my own .mat data, it stopped after a while with this error: ValueError: Did not fully consume compressed contents of an miCOMPRESSED element. This can…
yunyang
  • 43
  • 4
0
votes
1 answer

How can I save my array into a matlab struct in Python?

I have loaded some struct (called sensor) into python from my Matlab by doing this from scipy.io import loadmat pathToData="C:\Projects\" fileName = "\sensor.mat" pathToData = pathToData + fileName matfile = loadmat(pathToData, squeeze_me=True,…
ndarkness
  • 1,011
  • 2
  • 16
  • 36
0
votes
1 answer

How to split 'matfile' (which has 4 elements)? I want to save each element into separate list

I am trying to split 4 elements in 'xxx.mat' file and want to store each element into a separate list. In other words, I want (100,100) data and save into other list and then, I want to make image file (.bmp) by using that data (100,100). xxx.mat…
0
votes
0 answers

MATLAB .mat file not found when using readMat() in R

I have 3 matrices that I have saved as a Matlab .mat file. I am trying to get a script in R the read them. Now that they are saved, I am using the R.matlab package to access the readMat() function to read the files. My .mat file is in downloads, as…
Trey
  • 19
  • 4
0
votes
0 answers

convert mat-files in Python to JSON

I want to load a mat-file in Python and convert it to a JSON format. I can load it with loadmat-command but I can not convert it to JSON with the json.dumps command. I create a Dash GUI. In this, I want to load a mat-file in a callback and save it…
Philipp Reis
  • 1
  • 1
  • 1
0
votes
3 answers

How to save a text file to a .mat file?

How do I save a '.txt' file as a '.mat' file, using either MATLAB or Python? I tried using textscan() (in MATLAB), and scipy.io.savemat() (in Python). Both didn't help. My text file is of the format: value1,value2,value3,valu4 (each row) and has…
Dr. Strange
  • 87
  • 11