Effacer les filtres
Effacer les filtres

How to Read a file with unknown name

15 vues (au cours des 30 derniers jours)
naman
naman le 24 Jan 2017
Commenté : naman le 24 Jan 2017
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 ?

Réponse acceptée

John Chilleri
John Chilleri le 24 Jan 2017
Modifié(e) : John Chilleri le 24 Jan 2017
Hello,
You can do so like this (assuming only one csv file):
A = dir('*.csv');
B = csvread(A.name);
Hope this helps!
  1 commentaire
naman
naman le 24 Jan 2017
Yes, this solves the problem. Thanks

Connectez-vous pour commenter.

Plus de réponses (1)

Image Analyst
Image Analyst le 24 Jan 2017
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

Catégories

En savoir plus sur Data Import and Analysis dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by