My problem of sequence
Afficher commentaires plus anciens
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 commentaire
Walter Roberson
le 8 Oct 2026 à 5:33
Are the a and R2_a and R3_a part of the matrices? If so then what datatype are the matrices?
Réponses (1)
Walter Roberson
le 8 Oct 2026 à 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 commentaires
Walter Roberson
le 8 Oct 2026 à 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
le 8 Oct 2026 à 16:25
Catégories
En savoir plus sur Logical dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!