Borrar filtros
Borrar filtros

How to get values from an array using another logical array

20 visualizaciones (últimos 30 días)
Ramiro Rea
Ramiro Rea el 11 de Oct. de 2017
Editada: Ramiro Rea el 11 de Oct. de 2017
I have an array 280x5 values, which contains reaction times. I have another array with the same dimensions that stores the trials that fulfill certain condition (a logical array). I want to extract the values from the first array using the second as an index. I have tried just using it as A(B) but it returns all the values as a single column with the reaction times, and I would like the output to be another array with the same dimensions with the reaction times and 0's. Could you guide me into solving this?
Many thanks, Ramiro

Respuesta aceptada

OCDER
OCDER el 11 de Oct. de 2017
Instead of
A(B)
try
A.*B
  2 comentarios
Ramiro Rea
Ramiro Rea el 11 de Oct. de 2017
Editada: Ramiro Rea el 11 de Oct. de 2017
Great! How silly of me, I never though on multiplying it. Thanks a lot!
OCDER
OCDER el 11 de Oct. de 2017
You're welcome :)

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

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