Attempt to grow array along ambiguous dimension.

조회 수: 2 (최근 30일)
Rafi Rubenstein
Rafi Rubenstein 2020년 2월 4일
편집: Stephen23 2020년 2월 5일
a = [0:80];
b = flip(a);
multA = ones(a);
multB = ones(a);
multAB = ones(a);
for i=1:80
multA(i) = (factorial(a(i)+99))/(factorial(a(i))*factorial(99));
multB(i) = (factorial(b(i)+99))/(factorial(b(i))*factorial(99));
multAB(i) = multA(i)*multB(i);
end
Error: Attempt to grow array along ambiguous dimension.
Why do I keep getting the above error? What is the ambiguous direction?
  댓글 수: 1
Stephen23
Stephen23 2020년 2월 5일
편집: Stephen23 2020년 2월 5일
Note that your results will be not be accurate (down to ones precision), as the values you are working with (e.g. 99!) are well above flintmax. If you require a precise output then you will need to use symbolic maths or a high-precision integer class:

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

답변 (1개)

the cyclist
the cyclist 2020년 2월 4일
The way your defined your mult variables, they are 81-dimensional arrays. I think you meant:
multA = ones(size(a));
multB = ones(size(a));
multAB = ones(size(a));

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by