필터 지우기
필터 지우기

Handling of large string array

조회 수: 1 (최근 30일)
Christian F.
Christian F. 2015년 4월 4일
편집: per isakson 2015년 4월 4일
Hi,
I am dealding with a 22,000,000 x 1 string array, which causes Matlab real problems. I import the data from a .csv file of about 1gig size. But when I save it in Matlab as a .mat file, it blows up to over 9gig. How can I save this vector more efficiently?
Best
  댓글 수: 1
per isakson
per isakson 2015년 4월 4일
편집: per isakson 2015년 4월 4일
I cannot reproduce your problems on R2013b,64bit,Win7
>> str = char( randi([32,112],22e6,1) );
>> save( 'd:\tmp\test.mat', 'str' )
creates a file that is 18MB.

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

답변 (1개)

dpb
dpb 2015년 4월 4일
Cast to char() if not (default Matlab storage is double). This will be 4:1 reduction as Matlab character is 16-bit. If you're using a ASCII code, you can save another factor of 2 by converting to uint8 but Matlab may then get confused if try to use the data as character.

카테고리

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