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

MAT-files load slower the first time than the subsequent times

I want to load a large set of MAT-files in a loop. I'm testing different ways to make the files load faster, and I have a subset of 10,000 files I'm working with, each containing about 50 variables of different sizes. I noticed an interesting…
dima1109
  • 193
  • 1
  • 1
  • 7
1
vote
2 answers

Txt import in Matlab, different row formats

I need to import variables from a txt file. This file has 3 main parts. A) Initial headlines, containing general information B) Headlines-Variables, in every column C) Numerical data in every column As below: Headlines - Headlines - Headlines -…
Evans1985
  • 13
  • 3
1
vote
1 answer

MATLAB: Opening and Editing Files nested in folders in folders

I'm working on a project where I need to pull files from this expansive directory with many subfolders nested in folders. I'm a complete novice when it comes to using matlab and directories, and I was wondering if anyone could help get me started!…
1
vote
1 answer

gmdistribution.fit and .mat files

I've a very large .mat file which contains a lot of data which I need to visualize. .mat file contains 5 row with each row containing 1x5 matrix - which contains the data. I need to concatenate specific rows together, then apply gmdistribution.fit…
Mike Smith
  • 139
  • 2
  • 2
  • 12
1
vote
1 answer

Combining 2 .mat files

To combine data, I want to load one data as the base assign the data to another variable (e.g. naming it as base_data). Then load in another data and loop through all of its fields. If the current field doesn't exist in the base data, add the field…
1
vote
1 answer

How to access variables saved in .mat file in a built jar file by MATLAB Builder JA?

I have been so distracted by the whole amount of pages documenting MATLAB Builder JA and running very low on time. My question is, how could I load a .mat file and access all variables of it? What I did is, I made my own class with all functions I…
Mohamed Taher Alrefaie
  • 15,698
  • 9
  • 48
  • 66
0
votes
2 answers

Access a .mat file in MATLAB (without using Load function)

I have a struct (of matrices) in Matlab that has been saved on the harddisk. I currently use load to load these files inside my functions. Do you have any suggestions of doing this someother way that is much faster? (Yes, I can pass the struct…
Maddy
  • 2,520
  • 14
  • 44
  • 64
0
votes
1 answer

Trouble reading .mat files in Python

Whenever I try to read a .mat file in Python, I get the following error message ValueError: Unknown mat file type, version 9, 99 The particular dataset I want to open is here, named "GSE137764_HCT_GaussiansGSE137764_mooth_scaled_autosome.mat". I…
sam wolfe
  • 103
  • 9
0
votes
1 answer

Load matlab .mat export of signal logs in python

I am exporting signals in matlab R2023a like this: save logs.mat logsout -v7 v7 is recomended version for reading the file in python (seen in different threads). However, the file read by python is different from what I have in matlab. In matlab I…
Ruli
  • 2,592
  • 12
  • 30
  • 40
0
votes
0 answers

Python : issues when loading .mat with scipy.io.loadmat()

I meet some troubles when I try to laod matlab file (.mat) with scipy (scipy.io.loadmat). The dataset (4 Go) is an output from a wave numerical model (SWAN). The message error is : ValueError: Did not read any bytes The strange thing is that the…
Edouardo
  • 1
  • 1
0
votes
1 answer

How i can resolve Java.lang.NoClassDefFoundError?

I'm trying to make a jar of a code that i made in maven. But when i try to execute the jar generated by: mvn clean package I got the following error: rror: Unable to initialize main class Caused by: java.lang.NoClassDefFoundError:…
Panda
  • 1
0
votes
0 answers

error: Error -3 while decompressing data: invalid code lengths set

I've been trying to load a .mat file on Google Colab, and it seems like my code failed to decompress the data into desired file. Here is the loadData function, def loadData(name): data_path = os.path.join(os.getcwd()) if name ==…
pdfMonkey
  • 13
  • 3
0
votes
0 answers

Save dictionary of dictionary in .mat format

Suppose data, saved in .mat file needs to be annotated or the meta-data of some file need to be stored: x = np.array([[1, 2, 3], [4, 5, 6]], np.int32) mdic = {"data": x, "classes": {'name_of_class_1': 0, …
Michael
  • 339
  • 2
  • 11
0
votes
1 answer

How to convert datetime.datetime to array?

I have an array that contains datetime.datetime objects. They are as follows: array([datetime.datetime(2011, 1, 1, 0, 3, 32, 262000), datetime.datetime(2011, 1, 1, 0, 5, 7, 290000), datetime.datetime(2011, 1, 1, 0, 6, 45, 383000), …
0
votes
0 answers

Can not Convert mat file to Dataframe as wish

I have this file: Mat file I would like to convert this file to dataframe (6 columns). I have tried many methods on the internet but I did not get the dataframe I wish. The most effective code I have tried up to now: Code example With that code, I…
Jakhanh
  • 11
  • 3