Abs "too many input arguments"

조회 수: 21 (최근 30일)
Gabriel Alves
Gabriel Alves 2016년 10월 31일
답변: Steven Lord 2016년 10월 31일
I am taking a Engineering Computation college course and I'm very new to Matlab. I cannot take the absolute value of a vector as it keeps telling me too many input arguments. I need to take the negative values of the vector and change them to positive, if there is another way to do this I would like to know as well. Thank you!
  댓글 수: 1
Alexandra Harkai
Alexandra Harkai 2016년 10월 31일
What is the code where you're getting the error?

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

답변 (1개)

Steven Lord
Steven Lord 2016년 10월 31일
This:
abs(1, -2, 3)
is very different from this:
abs([1, -2, 3])
The former will throw the "too many input arguments" error you received because you're trying to call abs with three input arguments, each of which is a 1-by-1 array (a scalar.)
The latter will return a 1-by-3 array because you called abs with one input argument and that input argument was a 1-by-3 array (a vector.)
The documentation for the abs function does not show a three input syntax as being supported, it only shows a one input syntax.

카테고리

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