Undefined function 'abs' for input arguments of type 'cell'.

조회 수: 5 (최근 30일)
Daniel McCully
Daniel McCully 2019년 11월 18일
댓글: Daniel McCully 2019년 11월 20일
function c = test(A)
r=abs(A(2,2));
disp(r);
end
I'm trying to take the absolute value of a specific cell but i get this error.
Undefined function 'abs' for input arguments of type 'cell'.
Error in test (line 2)
r=abs(A(2,2));
What is going on that I can't see?
A is also a matrix with dimensions of at least 2x2.

채택된 답변

Erivelton Gualter
Erivelton Gualter 2019년 11월 18일
It is saying A is a cell type. In order to check it, run the following code:
class(A)
If this is the case, the following should work:
function c = test(A)
r=abs([A{2,2}]);
disp(r);
end
  댓글 수: 1
Daniel McCully
Daniel McCully 2019년 11월 20일
Yah I did not realize there was a difference between { } and [ ] when inputting matrices. So my code was correct I was just inputting values wrong.

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

추가 답변 (0개)

카테고리

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

태그

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by