Create a function to extract data several csv files
Ältere Kommentare anzeigen
Hello! I´ve been trying to use the Import data/create a function to select a part of my csv files. I want to take matrix of data from a lot of different files. The layout is always the same, so I read tutorials. I try with: http://nl.mathworks.com/help/matlab/import_export/import-data-interactively.html But I get Undefined function 'importfile' for input arguments of type 'char'.
I want, if it is possible a function to use is several csv files. I want to create the matrix numbers. I have a lot of files to run. Can it be done? I think I have a problem to make matlab understand how to change to other files. If I use Import script I get the data but only for that one csv file I used. Not for others.
I am really new at these, any help is a lot! thank you.
5 Kommentare
ly
am 20 Okt. 2015
Can you upload your csv files and discrible more details about what need be done?
Guillaume
am 20 Okt. 2015
Thorsten
am 20 Okt. 2015
Please upload your code to show what you have tried so far.
Milagros ARIETTI
am 20 Okt. 2015
Milagros ARIETTI
am 21 Okt. 2015
Akzeptierte Antwort
Weitere Antworten (2)
TastyPastry
am 20 Okt. 2015
Place all the files you need to work with in your current directory and use
files = dir('*.csv');
This will list all the .csv files in your folder and you can loop through them using a function of your choosing.
1 Kommentar
There is no need to place the files in the current directory and I would advise against that as it's a good way to loose some files in the process. dir happily works in any directory:
files = dir(fullfile('c:\path\to\folder', '*.csv'));
Milagros ARIETTI
am 20 Okt. 2015
0 Stimmen
Kategorien
Mehr zu Text Files finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!