How to Read a file with unknown name

1 回表示 (過去 30 日間)
naman
naman 2017 年 1 月 24 日
コメント済み: naman 2017 年 1 月 24 日
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 件のコメント
naman
naman 2017 年 1 月 24 日
Yes, this solves the problem. Thanks

サインインしてコメントする。

その他の回答 (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 Center および File ExchangeSpreadsheets についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by