Find a specific data set in a matrix

I need help with a problem. I want to find the position of a specific data set in a matrix, and I do not find a function that really works. An example: In the matrix A = [1 3 4 7 10 3 7 9 19 10 1 5 8 3 7] I want to find the position of the array (3, 7), which will be the positions (7, 15). Any ideas?

1 个评论

What do you mean (3,7) & (7,15) ? Give your expected output as an example.

请先登录,再进行评论。

 采纳的回答

Jan
Jan 2018-10-9
编辑:Jan 2018-10-9
Maybe you mean:
A = [1 3 4 7 10 3 7 9 19 10 1 5 8 3 7];
P = [3, 7];
index = strfind(A, P)
In opposite to the name, strfind does not operate on strings or char vectors only.
This replies [6, 14], so maybe you want to add 1 to the result.

更多回答(0 个)

类别

在 帮助中心 和 File Exchange 中查找有关 Matrix Indexing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by