how to store the matrix into dat file.
Afficher commentaires plus anciens
Hi,
I have one question about saving the matrix into .dat file. I donot know how to implement it. I will describe the question.
1. I have one matrix c

2. I want to save c into one .dat file in this format:
1 qid:1 1:0.4709 2:0.1948 3:0.2277 4:0.9254
2 qid:1 1:0.2305 2:0.2259 3:0.4357 4:0.4302
3 qid:1 1:0.8443 2:0.1707 3:0.3111 4:0.1848
The elements are separated by a space character Does anybody can help me solve this problem? Thanks so much.
Réponse acceptée
Plus de réponses (1)
Azzi Abdelmalek
le 5 Août 2016
A=rand(3,5)
fid=fopen('file.dat','w')
fprintf(fid,[repmat('%f ',1,4) '\r\n'],A)
fclose(fid)
1 commentaire
song
le 5 Août 2016
Catégories
En savoir plus sur Standard File Formats dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!