import csv into mate

2 visualizaciones (últimos 30 días)
Carlos_conde
Carlos_conde el 15 de Mzo. de 2018
Comentada: Carlos_conde el 15 de Mzo. de 2018
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?

Respuesta aceptada

KL
KL el 15 de Mzo. de 2018
Editada: KL el 15 de Mzo. de 2018
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 comentario
Carlos_conde
Carlos_conde el 15 de Mzo. de 2018
Thanks for your answer. You have solved my problem :)

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Structures en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by