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

Efficient disk access of large number of small .mat files containing objects

I'm trying to determine the best way to store large numbers of small .mat files, around 9000 objects with sizes ranging from 2k to 100k, for a total of around half a gig. The typical use case is that I only need to pull a small number (say 10) of…
MatlabSorter
  • 1,290
  • 1
  • 11
  • 19
4
votes
0 answers

Can not read a file using ngx-mat-file-input with Angular 10

Im new with angular, and im trying to read a csv file. My problem is when i use ngx-mat-file-input to load a file, i get an error like this: Uncaught TypeError: Failed to execute 'readAsText' on 'FileReader': parameter 1 is not of type 'Blob'. My…
4
votes
0 answers

Read .mat files in python whose content is a table

I was wondering whether I can read in Python a .mat file that contains a Table, is that possible? I have read this post, but not much is mentioned there. So far I have tried to read my .mat that contains the table in this way import tables from…
ndarkness
  • 1,011
  • 2
  • 16
  • 36
4
votes
0 answers

Display image with format .mat in OpenCV Python

I am trying to replicate a code taht I did in MATLAB to Python, using OpenCV. I have an image with .mat format that I managed to load, however I cannot displayed it using cv2.imshow(), since it does not supports it. So does anyone know how I can…
turningpointe
  • 43
  • 1
  • 4
4
votes
1 answer

MATLAB: Show a progress bar when saving file?

I have a MATLAB GUI (developed in GUIDE) where I give the user the option to save certain data-structure variables (as a .mat file). However, this is a large .mat file and it can take up to a minute to save this file. Without any sort of progress…
DeeWBee
  • 695
  • 4
  • 13
  • 38
4
votes
1 answer

Creating a .mat file of v7.3 in python

I need to perform multiplication involving 60000X70000 matrix either in python or matlab. I have a 16GB RAM and am able to load each row of the matrix easily (which is what I require). I am able to create the matrix as a whole in python but not in…
SH_V95
  • 161
  • 1
  • 3
  • 11
4
votes
0 answers

Writing number to .mat gives other result than to text file

I'm measuring the runtime of my system with an ArrayList runtime. The different entries of the list I'm getting through System.nanoTime(); which returns a long. I'm now writing this ArrayList to a text file by just looping over the list and…
machinery
  • 5,972
  • 12
  • 67
  • 118
4
votes
1 answer

Save .mat file, use -v7.3 switch?

I'm running an m-file, creating two variables, Clus and Watts_Map. I want to save both variables to a file that ends in ".mat". Both are variables are dimensioned as (1152,241,319), with 1152 as 360 deg longitude in 0.3125 deg increments, 241 as…
Kevin_Q
  • 73
  • 2
  • 8
4
votes
2 answers

Is it possible to read .mat files in Go?

I'd like to load a MATLAB file that stores a 1x1 struct with 4 fields using Go. I haven't found anything comparable to Python's SciPy which has a "loadmat" function. What is the best way to read .mat files in Go?
Adam Soffer
  • 1,614
  • 5
  • 20
  • 36
4
votes
1 answer

Cannot save really big matrix in Matlab

I have a big array (1024x1024x360) and I want to save it to a mat file. When I just try A=rand(1024,1024,360) save('filename.mat','A'); The variable is created in the workspace, the file is being created, but it remains empty... I'm using Matlab…
user2066183
3
votes
1 answer

Numpy array with elements of different last axis dimensions

Assume the following code: import numpy as np x = np.random.random([2, 4, 50]) y = np.random.random([2, 4, 60]) z = [x, y] z = np.array(z, dtype=object) This gives a ValueError: could not broadcast input array from shape (2,4,50) into shape…
Ahmed Mustafa
  • 119
  • 1
  • 11
3
votes
1 answer

Save multiple variables from a list of names in one go without using loop

I'm trying to save list of variables from the workspace into a .mat file. The problem I encountered is that I'm trying to make a function of it, and that function should be able to handle a list of variables to be saved. I could loop as below: vars…
Gregor Isack
  • 1,111
  • 12
  • 25
3
votes
1 answer

Error in MATLAB when opening .mat files with Chinese characters written by savemat

It looks like savemat is producing .mat files that MATLAB cannot open when they contain Chinese characters, but loadmat is able to: $ python -c 'from scipy.io import *; savemat("tmp.mat", {"test": "你好"}); print(loadmat("tmp.mat")["test"])' && matlab…
Kathi
  • 99
  • 1
  • 5
3
votes
1 answer

how to import a matlab table in R

I have a matlab .mat file with table data type which I want to import in R. I am using 'readMat' for this and R is reading it as a List. After that is there a way to convert the list into either a dataframe or table format in R? When I use…
3
votes
1 answer

How to load specified variables from a mat file

I have some mat files with large number of variables saved in it. So I only want to load a subset of the variables. For example, if I want to load vars = {'x', 'y', 'z'} I know I can explicitly do a = load('filename.mat', 'x', 'y', 'z') but the…
LWZ
  • 11,670
  • 22
  • 61
  • 79
1 2
3
14 15