Increasing Buffersize while importing data

I am importing data from txt file to matlab.But the programmme gives error:"Buffer overflow (bufsize = 4095) while reading string from" I am using textscan command in the programme.So buffer size should be increased.how?

답변 (1개)

per isakson
per isakson 2012년 9월 14일

0 개 추천

Hint:
textscan( ..., 'BufSize', new_size )
See the help.

댓글 수: 6

Tinkul
Tinkul 2012년 9월 14일
If new_size is not specifiedor i don't know the new sizeand the size is very big then what i have to write.....
per isakson
per isakson 2012년 9월 14일
The documentation does not mention an upper limit AFAIK. Try with a number, which you think is large enough.
Tinkul
Tinkul 2012년 9월 14일
sorry, still it is not working.I have full of data in txt file.Then what may be the new size.
Try
textscan( ..., 'BufSize', new_size, 'ReturnOnError', false )
What message do you get? Next multiply new_size by ten. What message do you get? Next try
str = fileread( file_spec );
ix = strfind( str, char(10) );
mx = max( ix );
What is the value of mx?
Tinkul
Tinkul 2012년 9월 14일
I m writing like that x=fopen('m.txt','r'); input_text=textscan(x,'%s','bufsize',10^999); A=input_text{1}; y=[A{:}] error: Error using ==> textscan Buffer size must be integer-valued.
Error in ==> mat_hex_dec at 5 input_text=textscan(x,'%s','bufsize',10^999);
per isakson
per isakson 2012년 9월 14일
편집: per isakson 2012년 9월 14일
Do you know how many disks you need to store a file of the size, 10^999 bytes? 10^999 is not exactly "multiply by ten".
How large is the file on disk? You do not need a buffer larger than the file!
Did you try
str = fileread( file_spec );
ix = strfind( str, char(10) );
mx = max( ix );
add
sz = size( str )

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

카테고리

도움말 센터File Exchange에서 Dates and Time에 대해 자세히 알아보기

태그

질문:

2012년 9월 14일

Community Treasure Hunt

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

Start Hunting!

Translated by