Read Data from .CSV File
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi there,
I am interested to read .csv file into MATLAB but got stuck after several trails. I'm new to MATLAB computation and hope to learn from you guys.
Allow me to explain about the data: The data in the .csv file is separated by comma and each column namely: FileName, Position 1 to 102. I want to be able to skip the first few header lines, then read FileName and its corresponding flow value which is below the 'Position' column. Later on I will do calculation for this 102 number of Flow value and want to output each results associated with the FileName.
Below is the data in .csv file:
---------------------------------------------------------------
New flow data every 10 msec (except APV @ 20 msec)
PS518_10p
Velocities are cm/sec
Spectral bin values
FileName 1 2 3 4 5 .... 102
ASDASD.1.csv 25 -32 -31 -31 -31
SFDFAA.2.csv 25 384 528 222 384
REABZX.3.csv 25 -32 -31 -31 -31
ASDGFA.4.csv 25 222 287 528 287
.
.
.
.
N FileName
Thanks ~Kent
0 commentaires
Réponses (1)
Nirmal
le 5 Juil 2012
fid = fopen(filename);
M=textscan(fid,'%s','collectoutput',1,'headerlines',0);
fclose(fid);
X=M{1,1};
X will be a array consisting of each line as a row, you will need to parse each row to separate the column.
Hope it helps.
0 commentaires
Voir également
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!