필터 지우기
필터 지우기

Saving Multiple .dat files

조회 수: 2 (최근 30일)
Leostar90
Leostar90 2022년 11월 4일
댓글: Leostar90 2022년 11월 7일
I have a matrix with size of 2000*1000. I want to save it into multiple .dat files in such way that each .dat file should have 2000*1 (One vector). So in this way I will have 1000 dat files. I tried many ways but no success yet. Any idea?

채택된 답변

Davide Masiello
Davide Masiello 2022년 11월 4일
This should work
A = rand(2000,1000);
for col = 1:size(A,2)
filename = ['Column_',num2str(col),'.dat'];
writematrix(A(:,col),filename)
end
  댓글 수: 1
Leostar90
Leostar90 2022년 11월 7일
Thanks. It worked perfectly.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by