Borrar filtros
Borrar filtros

saving value to .txt file with using dlmwrite

2 visualizaciones (últimos 30 días)
Libor Voprsalek
Libor Voprsalek el 25 de Mayo de 2019
Comentada: dpb el 25 de Mayo de 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 comentario
dpb
dpb el 25 de Mayo de 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.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre String Parsing en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by