Borrar filtros
Borrar filtros

How can I save each column of a matrix as separate .dat file?

2 visualizaciones (últimos 30 días)
Titli
Titli el 1 de Ag. de 2017
Comentada: KSSV el 1 de Ag. de 2017
I have a matrix of 40 columns. I want to save separate .dat files for each column. Can anyone help me with it?
Thanks in advance.

Respuesta aceptada

KSSV
KSSV el 1 de Ag. de 2017
Editada: KSSV el 1 de Ag. de 2017
A = rand(10,40) ;
for i = 1:size(A,2)
filename = strcat('column',num2str(i),'.txt') ;
c = A(:,i) ;
save(filename,'c','-ascii')
end

Más respuestas (0)

Categorías

Más información sobre Matrix Indexing 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