Is there a way to find the index of a subsection of a vector?

1 回表示 (過去 30 日間)
David Haydock
David Haydock 2022 年 6 月 7 日
回答済み: David Haydock 2022 年 6 月 7 日
Lets say I have the vector
a = [1,2,1,2,3,4,5,1,2,1];
and I need to search through it to find:
b = [1,2];
and get the output which shows me the indexes of where the start of each b is.
i.e.
out = [1, 3, 8];
Any help would be appreciated

採用された回答

David Haydock
David Haydock 2022 年 6 月 7 日
strfind

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