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

1 vue (au cours des 30 derniers jours)
% 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

Réponses (1)

Walter Roberson
Walter Roberson le 30 Nov 2017
filename = sprintf('trans%04d.txt', t);
dlmwrite(filename, transmat2)

Catégories

En savoir plus sur Text Data Preparation dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by