필터 지우기
필터 지우기

How to get values from an array using another logical array

조회 수: 20 (최근 30일)
Ramiro Rea
Ramiro Rea 2017년 10월 11일
편집: Ramiro Rea 2017년 10월 11일
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

채택된 답변

OCDER
OCDER 2017년 10월 11일
Instead of
A(B)
try
A.*B
  댓글 수: 2
Ramiro Rea
Ramiro Rea 2017년 10월 11일
편집: Ramiro Rea 2017년 10월 11일
Great! How silly of me, I never though on multiplying it. Thanks a lot!
OCDER
OCDER 2017년 10월 11일
You're welcome :)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by