필터 지우기
필터 지우기

Hello, I would like to know how to store matrix values in a textfile. I am creating a 5x5 matrix in a for loop and in each iteration I have to export this matrix into a text file. When I use the dlmwrite function, it overwrites. How can I solve this

조회 수: 2 (최근 30일)
% transmat2 is a 5x5 Matrix
for t = 1:1:3
[LL, prior2, transmat2, obsmat2] = dhmm_em(data, prior1, transmat1, obsmat1,'max_iter', 1);
dlmwrite('trans.txt',transmat2,);
end

답변 (1개)

Walter Roberson
Walter Roberson 2017년 11월 30일
filename = sprintf('trans%04d.txt', t);
dlmwrite(filename, transmat2)

카테고리

Help CenterFile Exchange에서 Text Files에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by