What is the fprintf size limit?

조회 수: 3 (최근 30일)
Carl Pray
Carl Pray 2013년 4월 22일
편집: Jan 2016년 4월 24일
is there a size limit for fprintf? I have a code that writes out large text files with one fprintf command, and if the file gets above about 1 Gb, fprintf will not write it out. The size seems to be about 1E9 characters, but I was interested to know the exact number and could not find that number in any documentation.
  댓글 수: 2
Friedrich
Friedrich 2013년 4월 22일
편집: Friedrich 2013년 4월 22일
Mhh, never heard of any limit. What exactly is happening? Do you get any error or warning? What does your file "pointer" tells you as position? How does you fprintf call look exactly?
the cyclist
the cyclist 2013년 4월 22일
I see the same behavior [R2013a on Mac running OS X 10.8.3]. The nbytes output is zero, indicating that the command wrote 0 bytes, but there is no error or warning message.
I did a cursory search, and did not find any documentation of this limit.

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

채택된 답변

Jan
Jan 2013년 4월 22일
편집: Jan 2016년 4월 24일
1 GB file size means 1e9 characters, which are 2e9 bytes. This sounds like a 32 bit limit, so please test, if the limit is at 1073741824 characters. If so, the underlying C-function is the cause of the limit.
There have been further limitations of Matlab string functions, when the data contain CHAR(0) in several releases. Even printing a cell string stopped, when one of the elements contained no data, but this has been fixed in R2006a as far as I remember.
  댓글 수: 2
Carl Pray
Carl Pray 2013년 4월 22일
Yes, it appears this is the limit. If I write the first 1073741823 characters, it writes out fine. If I write 1073741824 characters, it does not write out anything. Thanks.
Sergio Grion
Sergio Grion 2015년 9월 11일
I can confirm that this limit still exists in R2015a

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

추가 답변 (1개)

Richard Laukaitis
Richard Laukaitis 2016년 4월 19일
use fflush to clear the buffer. The buffer size is being limited.

카테고리

Help CenterFile Exchange에서 MATLAB Compiler SDK에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by