import csv into mate

조회 수: 1 (최근 30일)
Carlos_conde
Carlos_conde 2018년 3월 15일
댓글: Carlos_conde 2018년 3월 15일
Hello all,
I have some problems to read the first column of multiples csv files and combine them in another matrix. Please find attached five *csv files and the code that I wrote to do it. If you run the code, the matrix A only contains one column.
Could you please help me?

채택된 답변

KL
KL 2018년 3월 15일
편집: KL 2018년 3월 15일
You're overwriting A everytime. Before you start the loop define A as a cell array,
A = cell(numFiles,1)
and then inside the loop, use it like,
A{i,1} = csvread...
and outside the loop covert it into a matrix,
A = cell2mat(A);
Keep in mind, I assume all your files have same number of columns with numeric data.
  댓글 수: 1
Carlos_conde
Carlos_conde 2018년 3월 15일
Thanks for your answer. You have solved my problem :)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by