MATLAB: How to import multiple .CSV files in MATLAB with no sequential filename

csvimport

I need to import 175 “.csv” files where each file contains 100 measurements from 400 items (Columns and Rows respectively). I have to write a script to import the data. The .csv files are named as D059546, D067966, D077936 etc.
Please HELP!

Best Answer

P = 'relative/absolute path to the folder where the files are saved';
S = dir(fullfile(P,'*.csv'));
for k = 1:numel(S)
F = fullfile(P,S(k).name);
S(k).data = csvread(F);
end