필터 지우기
필터 지우기

Error in max function

조회 수: 4 (최근 30일)
Ellen De Jonghe
Ellen De Jonghe 2020년 1월 15일
댓글: Andrei Bobrov 2020년 1월 15일
Why do I get this error?
>> MAX
a =
2 3 5
Index exceeds the number of array elements (1).
Error in MAX (line 2)
b = max(a)
I get the same kind of error when I dot this:
g1 = input('Give a number: ')
g2 = input('Give another number: ')
gg = max([g1,g2])
  댓글 수: 3
WalterWhite
WalterWhite 2020년 1월 15일
Both of the above mentioned codes are functioning properly without any error as they are supposed to
a = [2 3 5]
a =
2 3 5
>> b = max(a)
b =
5
>> reading
Give a number: 3
g1 =
3
Give another number: 99
g2 =
99
gg =
99
Ellen De Jonghe
Ellen De Jonghe 2020년 1월 15일
I don't know why, but like, 5 minutes ago, this script didn't function.
And now it does...
Strange..
Still thank you guys!

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

답변 (1개)

Walter Roberson
Walter Roberson 2020년 1월 15일
You accidentally defined a variable with the name max.

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by