comparision of cell elements

1 view (last 30 days)
Afiye Havva Geçgel
Afiye Havva Geçgel on 29 May 2019
Edited: madhan ravi on 29 May 2019
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 Comment
Jos (10584)
Jos (10584) on 29 May 2019
(not) equal to ???
what should be the outcome?

Sign in to comment.

Accepted Answer

madhan ravi
madhan ravi on 29 May 2019
Edited: madhan ravi on 29 May 2019
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 Comment
Adam Danz
Adam Danz on 29 May 2019
+1;
And if you want to ignore NaN values
yourcell = {[nan 3 4], [nan 3 4], [nan 3 4]};
isequaln(yourcell{:})

Sign in to comment.

More Answers (0)

Categories

Find more on Cell Arrays in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!