Help with csv data preparation
Mostra commenti meno recenti
I applied the code:
if true
% code
load file
fid = fopen('data.csv', 'r');
FC = textscan(fid, '%s', 'Delimiter', '\n');
fclose(fid);
FC = FC{1};
% extract data
for n = 1:length(FC)
Data{n, 1:3} = sscanf(FC{n}, '%s %d %f');
end
end
Still I have problems extracting values. Applying that CODES up before the "for" loop, matlab gives me cell:
'0000, 0,0 '
'0001, 1,0.2 '
'0010, 0,0 '
'0011, 0,0 '
'0100, 1,0.2 '
'0101, 0,0 '
'0110, 0,0 '
'0111, 0,0 '
'1000, 1,0.2 '
'1001, 0,0 '
'1010, 1,0.2 '
'1011, 0,0 ' and what I want is that I transform this into different columns as follows:
| 0 | 0 | 0 | 0 | 0 | 0 |
| 0 | 0 | 0 | 1 | 1 | 0.2 |
How could I do this?
4 Commenti
Azzi Abdelmalek
il 11 Nov 2013
To format your code, just skip 2 blank spaces on the left, don't skip lines
FRANCISCO
il 11 Nov 2013
Walter Roberson
il 11 Nov 2013
Please show us a sample input line as known to excel, and tell us what datatype excel thinks the first column is.
FRANCISCO
il 12 Nov 2013
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Text Data Preparation in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!