CSV file read and disassemble information
조회 수: 3 (최근 30일)
이전 댓글 표시
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?
댓글 수: 0
답변 (1개)
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.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Workspace Variables and MAT Files에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!