MATLAB: How to Read a file with unknown name

csvreaddlmreadmatrix

Hi
I get one .csv file in a directory and I cannot control the name of it. Therefore, I want to read it without knowing its name. How can I do it ?

Best Answer

Hello,
You can do so like this (assuming only one csv file):
A = dir('*.csv');
B = csvread(A.name);
Hope this helps!