saving value to .txt file with using dlmwrite

2 次查看(过去 30 天)
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 个评论
dpb
dpb 2019-5-25
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.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 String Parsing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by