How to find the corresponding value of an element in same row, but different column?

4 ビュー (過去 30 日間)
Elise Mangin
Elise Mangin 2022 年 3 月 20 日
編集済み: Matt J 2022 年 3 月 20 日
Hi everyone,
Perhaps a silly question, but:
I have several matrices that are approx. 1500-2000 rows and 13 columns each (corresponding to single-trial data, so one matrix per trial; from deeplabcut if anyone is familiar). I have a for-loop that uses the find function to find a specific element in column #13 for each matrix and lists them in a single column (so if I have 50 trials, I would then have a column of 50 numbers). I now simply want to find the corresponding element in column #1 (from the same row!) for each trial and generate another such list. Column #1 contains timestamp information, so I'm looking for the timestamp corresponding to the element found in column #13.
Here is some dummy code so far (this is after narrowing the data down to a specific range):
element_list = find(data(:,13);
element_I_want = element_list(1)
element_timestamp = ????
Thank you!!! I've tried a few things but keep getting errors. I'm sure I'm just missing something simple.

採用された回答

Matt J
Matt J 2022 年 3 月 20 日
編集済み: Matt J 2022 年 3 月 20 日
[elements,row]=unique(data(:,13))
element_timestamps=data(row,1)

その他の回答 (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