??? 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

 采纳的回答

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

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Matrix Indexing 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by