How to implement the fwrite function as in C language?
이전 댓글 표시
Hi there, I want to know if it is possible to implement the fwrite function same as the C language fwrite.
To further explain my question let's say we have fwrite function in C which writes binary data into a file. The syntax of the function is as follow
fwrite(memory containing the data, number of bytes each item to be written, total number of items to write, destination file)
example
fwrite(iq_buff, 2, 2*2600000, signal.bin)
Now my question is how can we specify the number of bytes to be written during the fwrite function and how much data needs to be written in the file?
댓글 수: 3
Rik
2022년 4월 8일
Matlab will write the entire variable (although you have the option to skip bytes from the start). You will have to index your variable to skip trailing bytes.
The Matlab fwrite function does not provide the exact syntax you describe, but you should be able to write a wrapper that does. What did you try so far?
If all else fails, you can also use mex to actually use the C function.
Imtiaz nabi
2022년 4월 8일
Imtiaz nabi
2022년 4월 8일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!