Reading numeric values from csv file
40 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Lola
el 7 de Jun. de 2022
Comentada: Lola
el 11 de Jun. de 2022
Hi there. I am trying to read numeric values on matlab from a csv file that is created using PuTTY. I want to read data in realtime from row 5 going onwards and column 3 specifically. The data is being captured in realtime. I have tried a using a matlab code but I can't seem to read in the numeric values. I also want to store the values displayed into an array for later use. Please kindly assist
5 comentarios
Walter Roberson
el 8 de Jun. de 2022
csvread can skip text header lines, and it can skip a fixed number of columns that can include text. But all entries after that on the line must be purely numeric. The only values that csvread would be able to handle in that file are the BPM (all of which happen to be 0 in the sample)
Respuesta aceptada
Chaitan Divagi
el 8 de Jun. de 2022
Hello Lola,
I understand that you want to read the numeric values from specific column from the csv file in realtime.
You can perform this task using MATLAB functions in the following manner:
data = readtable('<CSV-file>.csv','NumHeaderLines',5); % use readtable instead of csvread and 'NumHeaderLines', 5 skips the 5 rows from the table
col_vec = data(:, 3); % reads the 3rd colum from the table and stores in the col_vec variable
I hope that the information provided helps in resolving your query.
Thanks,
Chaitan,
3 comentarios
Walter Roberson
el 10 de Jun. de 2022
data = readtable('<CSV-file>.csv','NumHeaderLines',5); % use readtable instead of csvread and 'NumHeaderLines', 5 skips the 5 rows from the table
col_vec = data{:, 3} ; % reads the 3rd colum from the table and stores in the col_vec variable
Más respuestas (0)
Ver también
Categorías
Más información sobre Spreadsheets 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!