필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Why abs(-5) gives an array and not a single value?

조회 수: 1 (최근 30일)
Wen Shu Wong
Wen Shu Wong 2020년 10월 29일
마감: MATLAB Answer Bot 2021년 8월 20일
I tried to use abs(-5) but it gives me an array of 107.1957 109.9616 103.5453 109.7126 103.4645 and not 5?
  댓글 수: 1
Stephen23
Stephen23 2020년 10월 29일
abs(-5)
ans = 5
Please show us the complete output of this command:
which abs -all

답변 (1개)

Ameer Hamza
Ameer Hamza 2020년 10월 29일
편집: Ameer Hamza 2020년 10월 29일
Most probably, you have a function handle or function in your MATLAB path with the name abs(). Try following.
First, run
clear abs
and then run your code, if error persist, then run
which abs
If it gives a path to a user-defined file, change its name.

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by