How to find repeated array in a matrix

1 view (last 30 days)
Moe on 9 Jul 2014
Answered: Sara on 9 Jul 2014
Hello everyone,
Suppose matrix a is like:
and matrix b:
Then, I want matrix c to be like:
c = [2;3;10,11,12,1,4,5,2,3]
Matrix c is found an array of matrix b in matrix a, If it finds more than one, then it will write both or more row numbers in the matrix c

Accepted Answer

Sara on 9 Jul 2014
d = [];
for i = 1:numel(b)
d = [d;find(a==b(i))];

More Answers (1)

Azzi Abdelmalek
Azzi Abdelmalek on 9 Jul 2014
Edited: Azzi Abdelmalek on 9 Jul 2014
You can use ismember and find function


Find more on Matrices and Arrays in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by