How to import a particular text file and plot.
Afficher commentaires plus anciens
Here is the data that I wish to import:
Scan(+/- seconds),Sensor1Value,Sensor2Value,Sensor3Value,Sensor4Value
-1, 2, 8, 3, 4
'#' Comment Here
9, 0, 5, 6, 7
-------------------------------------
If I want to plot this kind of data,
fid = fopen(file.txt');
% read column headers
header = textscan(fid, '%s', 5, 'delimiter', ',', ... 'commentStyle', '#');
% read numeric data
data = textscan(fid, '%f %f %f %f %f', 'delimiter', ',', ... 'commentStyle', '#');
fclose(fid);
------------
My question is, when I type in header{1} I get all five columns. Shouldn't it be the case that if I type in header{1}, header{2}, header{3},...,header{5} I should get: Scan, Sensor1Value, Sensor2Value,...,Sensor4Value respectively?
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Text Data Preparation dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!