read csv file with a lot of columns.
Ältere Kommentare anzeigen
Hello guys, i have the uploaded .csv file and i would like to only read the numbers that start with 0. how do i that? i tried 'readtable' and it reads but it puts everything in one cell and for textscan it has way too many columns.
I would appreciate some help thanks!
Antworten (2)
A much better approach would use READTABLE to correctly import that numeric data (with decimal-commas in what is actually a semicolon-separated values file, not a CSV file). Do not import numeric data as text, as you are doing now. Fiddling around with text like that is fragile and inefficient.
T = readtable('rawdata.csv','FileType','text', 'Delimiter',';', 'DecimalSeparator',',',...
'ReadVariableNames',true, 'VariableNamingRule','preserve')
T.Timestamp % it even identifies the timestamp correctly.
1 Kommentar
Alex Perrakis
am 31 Mär. 2022
try this:
A=readtable('rawdata.csv','ReadVariableName',false);
B=table2array(A(:,1));
C=split(B,';');
output=C(:,2:125);
6 Kommentare
Alex Perrakis
am 30 Mär. 2022
B=table2array(A(:,1)); % converts the table, T, to a homogeneous array, B
C=split(B,';'); % split the string with delimiter semicolon.
output=C(:,2:125); % use linear indexing to find out the value starts with 0
Alex Perrakis
am 30 Mär. 2022
Arif Hoq
am 30 Mär. 2022
please attach your csv file
Alex Perrakis
am 30 Mär. 2022
Arif Hoq
am 30 Mär. 2022
try this:
A=readtable('rawdata2.csv','ReadVariableName',false);
B=table2array(A(:,1));
C=split(B,';');
output=C(:,2:126);
Kategorien
Mehr zu Text Files 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!