Filter löschen
Filter löschen

How to read all mat files from a folder in matlab?

193 Ansichten (letzte 30 Tage)
FARHAD
FARHAD am 2 Jul. 2014
Kommentiert: Image Analyst am 12 Okt. 2017
Hi, I have 1000 mat files in a folder. I want to use those mat files one by one. How do i read those files from a folder? Please help me.
  2 Kommentare
Ashraf
Ashraf am 12 Okt. 2017
Bearbeitet: Walter Roberson am 12 Okt. 2017
mat = dir('*.mat'); for q = 1:length(mat) load(mat(q).name); end
Image Analyst
Image Analyst am 12 Okt. 2017
You simply copied Uladzimir's 3 year old answer from below. Anyway, that is not as robust as the code in the FAQ, a link to which I gave in my answer.

Melden Sie sich an, um zu kommentieren.

Antworten (2)

Uladzimir
Uladzimir am 2 Jul. 2014
Try this: mat = dir('*.mat'); for q = 1:length(mat) cont = load(mat(q).name); end I haven't checked it yet, but I have an experience in opening csv files this way. I don't remember, may be "load" isn't correct for mat files.

Image Analyst
Image Analyst am 2 Jul. 2014

Kategorien

Mehr zu Introduction to Installation and Licensing finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by