필터 지우기
필터 지우기

saving value to .txt file with using dlmwrite

조회 수: 2 (최근 30일)
Libor Voprsalek
Libor Voprsalek 2019년 5월 25일
댓글: dpb 2019년 5월 25일
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