필터 지우기
필터 지우기

Memory overload with dec2bin

조회 수: 1 (최근 30일)
andreas
andreas 2013년 7월 8일
If i try to run this command:
M = dec2bin(0:2^21-1, 21);
I get the following error: "Error using * Out of memory. Type HELP MEMORY for your options."
When trying to run it with 2^20 it still works.
Is there a way to work around that error?
PS: I will have to work with that data later on. Is that even possible?

채택된 답변

Jan
Jan 2013년 7월 8일
This creates the vector 0:2^21-1 as double array at first, which requires 16.777.216 Bytes. Then for each of these values 21 characters a 2 Byte are created, which means additional 88.080.384 Bytes. If this exhausts your memory already, you simply do not have enough RAM. Then either use something like FEX: VChooseKRO to create the output as UINT8 array, which occupies the half size only:
M = VChooseKRO(uint8([0, 1]), 21);
But a much better idea would be to run a 64-bit Matlab version on a 64-bit operating system an installing some more GB of RAM.
  댓글 수: 1
andreas
andreas 2013년 7월 10일
Thank you. I went to another PC and it worked out very well.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by