My problem of sequence

My date base are two matrices R2_a = 3500000x30 and R3_a 3500000x30. The rows are integer numbers, one to sixty-seven, in ascendent sequence successive by zeros. I want to find one line at R2_a and another line at R3_a that have, in sequence, theses numbers:
2,3,4,5,6,8,10,11,14,15,17,18,19,23,26,28,29,31,36,38,43,44,45,47,50,54,57,58,59,60,61,62,63,64,65.
Example:
2 3 4 5 6 8 10 11 14 15 17 18 19 23 26 28 29 31 36 38 43 44 45 47 50 54 57 58 59 60 61 62 63 64 65 a
3 4 6 7 8 9 13 15 19 22 23 26 30 31 32 36 38 39 40 43 44 45 46 56 57 58 R2_a 2 5 10 11 14 15 17 18 22 28 29 30 34 46 47 49 50 54 57 59 67 R3_a

1 Comment

Are the a and R2_a and R3_a part of the matrices? If so then what datatype are the matrices?

Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 8 Oct 2026 at 5:36

0 votes

Your target vector is length 35. You have defined your matrices as having rows of length 30. It is not possible for a matrix of width 30 to match a target vector of width 35.

2 Comments

targetvector = [2,3,4,5,6,8,10,11,14,15,17,18,19,23,26,28,29,31,36,38,43,44,45,47,50,54,57,58,59,60,61,62,63,64,65];
match1 = find(ismember(R2_a, targetvector, 'rows'));
match2 = find(ismember(R3_a, targetvector, 'rows'));
match1 with contain row numbers of R2_a that match (possibly empty, possibly multiple entries), and match2 will contain row numbers of R3_a that match (possibly empty, possibly multiple entries)
AIRTON
AIRTON on 8 Oct 2026 at 16:25
Thanks Walter! The datatype of matrices are uint32! I don't want to find "targetvector" in R2_a or R3_a because the dimensions are different. I want to find one row in R2_a that has those numbers into "targetvector" and if R2_a has not all, then I can to find them in R3_a. But with a condition. In the same sequence of targetvector. Example: R2_a has 2,5,6,10,17. R3_a has 3,4,8,11,14,15.

Sign in to comment.

Tags

Asked:

on 8 Oct 2026 at 3:43

Commented:

on 8 Oct 2026 at 16:25

Community Treasure Hunt

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

Start Hunting!