フィルターのクリア

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 Center および File ExchangeMatrix Indexing についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by