CSV file read and disassemble information

4 Ansichten (letzte 30 Tage)
Sérgio Querido
Sérgio Querido am 2 Mai 2015
Beantwortet: Ahmet Cecen am 3 Mai 2015
I have this csv file with a person's fitness information and a want read it in matlab. I need to disassemble all variables from one cell to 28 cells (number of all variables). how can i do it?

Antworten (1)

Ahmet Cecen
Ahmet Cecen am 3 Mai 2015
You cannot use dlmread or csvread for mixed format files. To my best knowledge your best chance is a table:
T = readtable('file1.csv','Delimiter',',','ReadVariableNames',false);
C=table2cell(T);
A=cell(1,33);
B=cell(1,33);
c=0;
for i=1:66
if mod(i,2)==1
c=c+1;A{c}=C{i};
else
e=e+1;B{c}=C{i};
end
end
T = cell2table(B(6:33),'VariableNames',A(6:33));
I am assuming the first 5 values are unimportant, since you said 28 variables.

Kategorien

Mehr zu Workspace Variables and MAT Files finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by