Effacer les filtres
Effacer les filtres

saving value to .txt file with using dlmwrite

2 vues (au cours des 30 derniers jours)
Libor Voprsalek
Libor Voprsalek le 25 Mai 2019
Commenté : dpb le 25 Mai 2019
Hello, I trying to save a vector into the .txt file with using dlmwrite.
prozapis = [vysl,vysl2]
dlmwrite('dlmwrite_akc_1a2t.txt',prozapis,'delimiter','');
Here is the code I am using. Both vectors VYSL and VYSL2 contains 144 values, so vector PROZAPIS contains 288 values.
But the size of created txt file "dlmwrite_akc_1a2" is 289 byte instead of 288 and I need to reach .txt file which size is 288 byte.
Thank you for help.
  1 commentaire
dpb
dpb le 25 Mai 2019
You can't control the length of the file dlmwrite creates by default; it is a text file and the default precision is 5 digits which will be written with a '%g' format so may be either integers, floating point with decimal or exponential notation depending wholly on the magnitude of the output. Plus, there's the delimiter character which is one byte each element.
You can't output a 288-byte file containing 288 (default) double precision values, anyway; that's on possible if each is <=255 and you write a stream file with 8-bit values via fopen and fwrite
You'll have to describe far more fully what you have and what you're expecting--what you've actually written isn't possible.

Connectez-vous pour commenter.

Réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by