Borrar filtros
Borrar filtros

Consider only a positive numbers of the first columns.

1 visualización (últimos 30 días)
Francesco
Francesco el 1 de Mzo. de 2014
Comentada: Francesco el 1 de Mzo. de 2014
I have this matrix:
A =
-0.0001 -0.0723 0.0007 0.0013 -0.0007 -0.0016 -0.0009 0.0010 -0.0018
-0.0004 -0.0723 0.0008 0.0012 -0.0008 -0.0017 -0.0009 0.0011 -0.0017
-0.0005 -0.0723 0.0007 0.0013 -0.0008 -0.0017 -0.0009 0.0011 -0.0017
0.0002 -0.0723 0.0007 0.0012 -0.0007 -0.0017 -0.0009 0.0010 -0.0018
-0.0003 -0.0723 0.0006 0.0012 -0.0007 -0.0017 -0.0009 0.0011 -0.0017
0.0005 -0.0723 0.0007 0.0013 -0.0007 -0.0017 -0.0009 0.0011 -0.0017
My issue is to by-pass (or not consider) the rows that start with a negative number in the first column. How can I extend this procedure if I work with cell or struct variable? How can I do it?

Respuesta aceptada

Mischa Kim
Mischa Kim el 1 de Mzo. de 2014
Editada: Mischa Kim el 1 de Mzo. de 2014
Use
B = A(find(A(:,1)>0),:)
Concerning your second question: that, of course, depends on how your cell array looks like. In general, you could convert to a numeric array and then use the code above.
  5 comentarios
Mischa Kim
Mischa Kim el 1 de Mzo. de 2014
Well, as I said, it depends on how your cell array looks like. So for the one you're posting in your comment: do you want to treat the 8 different arrays as independent ones with regards to ignoring rows that start with a negative number in the first column? Or is this supposed to be one large 1000-by-72 matrix?
Francesco
Francesco el 1 de Mzo. de 2014
It's not supposed to be one marge 1000 by 72 matrix. But I would like to to the same procedure you said for each one of the 8 (or n) different arrays. As you said I want to: "treat the 8 different arrays as independent ones with regards to ignoring rows that start with a negative number in the first column"

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Multidimensional 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