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

2 visualizzazioni (ultimi 30 giorni)
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.

Risposta accettata

KSSV
KSSV il 1 Ago 2017
Modificato: KSSV il 1 Ago 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

Più risposte (0)

Categorie

Scopri di più su Creating and Concatenating Matrices in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by