Trying to predict equality between cell arrays

I have two cell arrays A and B
A 400 x 1 cell
{1 x 5 categorical
1 x 5 categorical
1 x 5 categorical
.......}
B 400 x 1 cell
{1 x 5 categorical
1 x 5 categorical
1 x 5 categorical
.......}
I tried to do
C = sum(B == A)./numel(A)
And I am getting the following error
Undefined operator '==' for input arguments of type 'cell'.
Then I tried the following
C = sum(B{:} == A{:})./numel(A{:})
And I am getting the folowing error
Error using ==
Too many input arguments.

답변 (1개)

David Hill
David Hill 2019년 10월 3일

0 개 추천

If you are just testing equality between the whole cells use:
isequal(A,B);

댓글 수: 1

I am not after isequal !
Anyway I got it to work by using a simple for loop.

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

카테고리

도움말 센터File Exchange에서 Categorical Arrays에 대해 자세히 알아보기

질문:

2019년 10월 3일

댓글:

2019년 10월 3일

Community Treasure Hunt

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

Start Hunting!

Translated by