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

조회 수: 2 (최근 30일)
Titli
Titli 2017년 8월 1일
댓글: KSSV 2017년 8월 1일
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.

채택된 답변

KSSV
KSSV 2017년 8월 1일
편집: KSSV 2017년 8월 1일
A = rand(10,40) ;
for i = 1:size(A,2)
filename = strcat('column',num2str(i),'.txt') ;
c = A(:,i) ;
save(filename,'c','-ascii')
end

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by