Out of memory error with zeros()

I'm having a strange problem where when I run
nrg=zeros(120001);
I'm getting an out of memory error, but if I have an array, say t, that is the same length and I do
nrg=t*0;
it has no trouble creating the array.
Thoughts?

댓글 수: 1

Jon
Jon 2013년 2월 16일
It's MATLAB 2011a for 64-bit Windows 7, btw.

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

 채택된 답변

the cyclist
the cyclist 2013년 2월 16일
편집: the cyclist 2013년 2월 16일

2 개 추천

That syntax will try to create a 120001 X 120001 array. That's pretty big. :-)
Guessing you wanted
>> nrg = zeros(120001,1)
This mistake was the highest-voted one in the thread "Dumb mistakes we make with MATLAB": http://www.mathworks.com/matlabcentral/answers/1759-dumb-mistakes-we-make-with-matlab

댓글 수: 1

Azzi Abdelmalek
Azzi Abdelmalek 2013년 2월 16일
zeros(120001) is the same then zeros(120001,120001)

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

추가 답변 (1개)

Jon
Jon 2013년 2월 16일

0 개 추천

Oh my, I didn't realize it did a square by default. Thank you gentlemen!

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

제품

태그

질문:

Jon
2013년 2월 16일

Community Treasure Hunt

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

Start Hunting!

Translated by