import csv into mate
2 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
采纳的回答
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.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Structures 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!