Memory overload with dec2bin
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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?
0 comentarios
Respuesta aceptada
Jan
el 8 de Jul. de 2013
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.
Más respuestas (0)
Ver también
Categorías
Más información sobre Logical en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!