How to get row index of certain values in a vector

3 visualizaciones (últimos 30 días)
Daniel
Daniel el 28 de Dic. de 2013
Comentada: Image Analyst el 29 de Jul. de 2018
I am looking for a way to extract the row index of certain values from a vector.
I tried with
[ ~ , index ] = max(obj.GanttM(:,2)==i);
This only gives me one index but the number i appears several times. How can I extract all row indeces with one command?
Thank you.

Respuesta aceptada

Image Analyst
Image Analyst el 28 de Dic. de 2013
Use find() instead:
rows = find(obj.GanttM(:,2)==i);
  1 comentario
Image Analyst
Image Analyst el 29 de Jul. de 2018
Start a new question. Attach your data and code there, after you read this.

Iniciar sesión para comentar.

Más respuestas (1)

Amit
Amit el 28 de Dic. de 2013
index = find(obj.GanttM(:,2)==i)
this will do it!

Categorías

Más información sobre Resizing and Reshaping Matrices en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by