why i cant have a=zeros(1:200)?

조회 수: 5 (최근 30일)
ihab
ihab 2015년 9월 22일
댓글: ihab 2015년 9월 23일
i get these message "Error using zeros Maximum variable size allowed by the program is exceeded" when i use a=zeros(1:200)

답변 (2개)

Guillaume
Guillaume 2015년 9월 22일
zeros(1:200)
means an array of 0s of size 1x2x3x4x5x...x199x200, a 200-D arrays with 200! ~= 8e374 elements. I don't think you'll find a computer with that much memory.
Not sure what you were trying to do. If you want to create a row vector with 200 zeros:
a = zeros(1, 200)
  댓글 수: 1
ihab
ihab 2015년 9월 23일
thank you very much for your answer.

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


Steven Lord
Steven Lord 2015년 9월 22일
You almost certainly meant a = zeros(1, 200) which creates a 200 element vector containing all 0's. What you wrote tries to create a 1-by-2-by-3-by-4-by-5-by-6-by-7-by-...-194-by-195-by-196-by-197-by-198-by-199-by-200 200-dimensional array.
Even if you created that as a logical array (1 byte per element) that would require about 7e350 yottabytes of memory. Read what would be required to store one yottabyte on that Wikipedia page, and realize that even if you could store one yottabyte of data in each atom in the universe, you still wouldn't come close to the memory required to store that array.
  댓글 수: 1
ihab
ihab 2015년 9월 23일
well,thank you very much, i think i understand now why.

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

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by