CSV file read and disassemble information

3 ビュー (過去 30 日間)
Sérgio Querido
Sérgio Querido 2015 年 5 月 2 日
回答済み: Ahmet Cecen 2015 年 5 月 3 日
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?

回答 (1 件)

Ahmet Cecen
Ahmet Cecen 2015 年 5 月 3 日
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.

カテゴリ

Help Center および File ExchangeWorkspace Variables and MAT Files についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by