Plot data from two columns in csv
11 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Tsalsabilla Winny Junika
el 10 de Abr. de 2019
Respondida: Star Strider
el 10 de Abr. de 2019
Hi, i want to plotting the data (x,y). x is timestamps, and then y is raw data. Here is my data:
![Capture.PNG](https://www.mathworks.com/matlabcentral/answers/uploaded_files/212972/Capture.png)
and then i just code to show the plot data:
clear;
clc;
data = csvread ('eegID.csv');
col1 = data(:, 1);
col2 = data(:, 2);
plot(col1, col2)
But, the command windows show
"Error using dlmread (line 147)
Mismatch between file and format character vector.
Trouble reading 'Numeric' field from file (row number 2, field number 1) ==> ;-57129\n
Error in csvread (line 48)
m=dlmread(filename, ',', r, c);
Error in csv (line 5)
data = csvread ('eegID.csv');"
FYI, im just newbie in matlab apps. Please help me. Thank you
0 comentarios
Respuestas (2)
Bob Thompson
el 10 de Abr. de 2019
data = csvread ('eegID.csv',1);
col1 = data(:, 1);
col2 = data(:, 2);
plot(col1, col2)
csvread cannot read non-numeric characters. You need to specify the number of header lines.
0 comentarios
Star Strider
el 10 de Abr. de 2019
The ‘\n’ is a linefeed character.
It is not possible to determine the format of your file from the information you posted. Use the detectImportOptions (link) function (if you have R2016b or a later release) to find out more about your file.
0 comentarios
Ver también
Categorías
Más información sobre Text Files en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!