Binary file size resets to zero after every iteration

조회 수: 1 (최근 30일)
Imtiaz nabi
Imtiaz nabi 2022년 4월 7일
편집: Imtiaz nabi 2022년 4월 7일
Hi there,
I am trying to write a binary file containing Intermediate Frequency data. The code needs to run for 30 iterations and at every iteration the binary file resets back to zero... I want it to continue writing to the file while keeping all the previous data in it too... Technically the file size needs to grow and grow and grow but after every iteration it returns back to zero and starts from the beginning.
what should I do?
Here's the code snippet that you might want to check...
The code is too big to be uploaded here so I will post only the desired section here

채택된 답변

Walter Roberson
Walter Roberson 2022년 4월 7일
'w' and 'W' access both request that the content of any existing file is deleted. You need 'a' (append) access.
  댓글 수: 2
Imtiaz nabi
Imtiaz nabi 2022년 4월 7일
so if I use 'a' will it still write binary data just like the wb or Wb? or I will need to use ab
Walter Roberson
Walter Roberson 2022년 4월 7일
'b' access is ignored in MATLAB. MATLAB defaults to binary.
C and C++ default to text access and need you to use 'b' for binary in those languages.
MATLAB defaults to binary and you need to use 't' for text in MATLAB.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Imtiaz nabi
Imtiaz nabi 2022년 4월 7일
Ok thank you let me try and if it works and I don't have any question then I will accept this answer thank you for now

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by