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 Kommentar

Jos (10584)
Jos (10584) am 29 Mai 2019
(not) equal to ???
what should be the outcome?

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

madhan ravi
madhan ravi am 29 Mai 2019
Bearbeitet: madhan ravi am 29 Mai 2019

2 Stimmen

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 Kommentar

+1;
And if you want to ignore NaN values
yourcell = {[nan 3 4], [nan 3 4], [nan 3 4]};
isequaln(yourcell{:})

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Mathematics and Optimization finden Sie in Hilfe-Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by