フィルターのクリア

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 Center および File ExchangeLogical についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by