finding all the other elements of a cell vector apart from zeros and empties

1 visualización (últimos 30 días)
Dear all,
I want to find all the elements of a cell vector apart from zeros and empties Using the command
ismember(mm,setdiff(mm,'0' ))
I find all the elements apart from zeroes. But I want to find all the elements apart from zeroes AND empty cells. Note mm is a cell of dimension 1000 by 1
thanks
  1 comentario
Thomas
Thomas el 4 de Jun. de 2012
can you post a small snipet of 'mm'. You say it is a cell but does it contain numbers and characters or just numbers..

Iniciar sesión para comentar.

Respuesta aceptada

Walter Roberson
Walter Roberson el 4 de Jun. de 2012
mm( ~ cellfun( @(C) isempty(C) || (ischar(C) && strcmp(C, '0')), mm ) )
  4 comentarios
Walter Roberson
Walter Roberson el 4 de Jun. de 2012
mm( ~ cellfun( @(C) isempty(C) || (ischar(C) && strcmp(C, '0')), mm ) & strcmp(mdata1(:,6),'b1') )

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements 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