How do you load a .csv file, skip lines within it, and plot the values?
Ältere Kommentare anzeigen
Hi. I seem to have problems loading a .csv file (see attached):
Blah
@Blah
2Blah
Blah
f Blah
fa Blah
Blahasd
Blahasda
vasf Blah
as Blah
asdas Blah
Date Time Ch1:
07/25/2012 42:46.0 96.385
07/25/2012 42:46.0 -177.608
07/25/2012 42:46.0 155.481
07/25/2012 42:46.0 64.15
%Here is my code:
fid = fopen('PULL1.CSV');
% I need to skip the 16 lines. header = textscan(fid, '%s',3,'delimiter', ',',... 'headerLines',16);
data = textscan(fid, '%s %s %s' ,'delimiter', ',');
The problem is that it only recognizes the parameters as strings. Date should be a string. Time should be a floating number. The Ch1 column is a set of values that I want to plot vs. time.
fclose(fid);
1 Kommentar
T
am 21 Sep. 2012
Akzeptierte Antwort
Weitere Antworten (1)
per isakson
am 21 Sep. 2012
Bearbeitet: per isakson
am 21 Sep. 2012
Try
data = textscan( fid, '%s%s%f', 'Headerlines', 16 );
Delimiter is obviously one or many "space" or tab. Default handles that.
1 Kommentar
T
am 21 Sep. 2012
Kategorien
Mehr zu Dates and Time 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!