??? Error using ==> ones , Maximum variable size allowed by the program is exceeded

hi every one
MATLAB will make me crazy,,,,, when i try to make an array with (16777216) elements, i got this error,,,,,
r=ones(16777216);
??? Error using ==> ones , Maximum variable size allowed by the program is exceeded
but when i make an array with the same number of elements but in diffrent dimensions then no problem.
r=ones(4096,4096);
reshape(r,1,16777216)
when i reshape the array to (1,16777216), then also no problem.
any one know why this happened?? its the same size, right?
i'm using (MATLAB R2010a) RAM : 6GB OS: win7/64bit CPU : Intel® Core™ i3 CPU M330 @ 2.13GHz 2.13GHz

 Respuesta aceptada

This:
r = ones(16777216)
tries to create a [16777216 x 16777216] matrix. Use this instead:
r = ones(1, 16777216)
See: help ones

1 comentario

ohh,
long time didnt use the matlab, already forget the commands,
:)
thanks

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Productos

Preguntada:

el 21 de Nov. de 2011

Community Treasure Hunt

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

Start Hunting!

Translated by