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

2 Ansichten (letzte 30 Tage)
Titli
Titli am 1 Aug. 2017
Kommentiert: KSSV am 1 Aug. 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.

Akzeptierte Antwort

KSSV
KSSV am 1 Aug. 2017
Bearbeitet: KSSV am 1 Aug. 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

Weitere Antworten (0)

Kategorien

Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by