First occurance problem in the adjacent coloumn

1 回表示 (過去 30 日間)
Anurag Gupta
Anurag Gupta 2020 年 10 月 28 日
コメント済み: Anurag Gupta 2020 年 10 月 28 日
Hi,
i=1
j=2
I have a matrix A=[1 9
9 10
10 11
11 2]
I want to find out the first occurance of j in coloumn 2 after occurance of i in 1st coloumn at index idx.
i tried idx2 = find(A(idx:end, 2) == j, 'first') but it shows me error Second argument must be a positive scalar integer.
Help is much appreciated thanking in advance.

回答 (1 件)

madhan ravi
madhan ravi 2020 年 10 月 28 日
[~, ix1_2] = max(A == [ii, jj])
  1 件のコメント
Anurag Gupta
Anurag Gupta 2020 年 10 月 28 日
Hi Madhan,
Thanks for replying to my query. although it is a bit difficult for me to understand the answer. it would be great if you can give a bit elaborative answer in context to my question.

サインインしてコメントする。

カテゴリ

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