MATLAB Answers

How to read all .csv files from a folder in an order?

113 views (last 30 days)
My programme is not reading the files in a proper order. The order of the files is sky_0, sky_1, sky_2,... sky_2001.
But it is reading in the order sky_0, sky_1, sky_10, sky_1000, sky_1001,... sky_1009, sky_10,...
Can anybody help me to read it in the right order?

Accepted Answer

Walter Roberson
Walter Roberson on 4 Dec 2020


Sateesh Kandukuri
Sateesh Kandukuri on 9 Dec 2020
Dear Walter Roberson, I ran the same programme to similar files in another folder. But, I am getting an error.
Index in position 2 exceeds array bounds (must not exceed 2).
Error in Readfiles2 (line 12)
col5 = data(:,5);
Could you please help me out
Walter Roberson
Walter Roberson on 9 Dec 2020
One of your files doesn't have 5 columns
When the program stops look at N{idx} for the name of the problem file

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by