comparision of cell elements

조회 수: 1 (최근 30일)
Afiye Havva Geçgel
Afiye Havva Geçgel 2019년 5월 29일
편집: madhan ravi 2019년 5월 29일
I have a cell like this:
cell={[1], [1 3 4], [],...
[], [3 4], [3 4], [3 4]}
I need to check if all elements of cell are equal or not.
I tried to use isequal, but it did not work.
How can I do that?
  댓글 수: 1
Jos (10584)
Jos (10584) 2019년 5월 29일
(not) equal to ???
what should be the outcome?

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

채택된 답변

madhan ravi
madhan ravi 2019년 5월 29일
편집: madhan ravi 2019년 5월 29일
First and foremost don’t ever use cell as a variable name:
isequal(yourcell{:}) % to check all the elements are equal to each other
  댓글 수: 1
Adam Danz
Adam Danz 2019년 5월 29일
+1;
And if you want to ignore NaN values
yourcell = {[nan 3 4], [nan 3 4], [nan 3 4]};
isequaln(yourcell{:})

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

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by