My problem of sequence
Show older comments
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
Walter Roberson
on 8 Oct 2026 at 5:33
Are the a and R2_a and R3_a part of the matrices? If so then what datatype are the matrices?
Answers (1)
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
Walter Roberson
on 8 Oct 2026 at 5:41
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
on 8 Oct 2026 at 16:25
Categories
Find more on Logical 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!