How to Read a file with unknown name

13 次查看(过去 30 天)
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 ?

采纳的回答

John Chilleri
John Chilleri 2017-1-24
编辑:John Chilleri 2017-1-24
Hello,
You can do so like this (assuming only one csv file):
A = dir('*.csv');
B = csvread(A.name);
Hope this helps!

更多回答(1 个)

Image Analyst
Image Analyst 2017-1-24
Use dir('*.csv') to get a list of all csv files in that folder. See the FAQ: http://matlab.wikia.com/wiki/FAQ#How_can_I_process_a_sequence_of_files.3F

类别

Help CenterFile Exchange 中查找有关 Data Import and Analysis 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by