Borrar filtros
Borrar filtros

comparision of cell elements

1 visualización (últimos 30 días)
Afiye Havva Geçgel
Afiye Havva Geçgel el 29 de Mayo de 2019
Editada: madhan ravi el 29 de Mayo de 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 comentario
Jos (10584)
Jos (10584) el 29 de Mayo de 2019
(not) equal to ???
what should be the outcome?

Iniciar sesión para comentar.

Respuesta aceptada

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

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Cell Arrays en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by