How to load and import a .mat file?
Ältere Kommentare anzeigen
Hi all,
I'm having a problem to load and read my ```mydata.mat``` in Matlab.
The structure is 1x1 with 2 fields data and hdr (header).

So I'm using the following syntax:
[data, hdr] = load("mydata.mat", "hdr9", "hdr10");
What I am doing that, I load the data and pick only the last 2 columns.
However, I am facing an error running the code:
>> [data, hdr] = load("mydata.mat", "hdr9", "hdr10");
Error using load
Too many output arguments.
And if I want to load without picking up the last 2 columns, it will give me the same error.
>> [data, hdr] = load("mydata.mat");
Error using load
Too many output arguments.
What is my mistake? And are there other ways to load and import the data?
Thank you!
Antworten (1)
As the documentation explains, using load with output arguments will return a struct.
help load
So what you need to do is loading your mat file to a struct and then extract the variables:
S=load("mydata.mat");
[data,hdr]=deal(S.data,S.hdr);
Kategorien
Mehr zu Large Files and Big Data finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!