How to find repeated patterns of combination of numbers in the rows of a matrix
I have a matrix with N rows (N is known) with 15 numbers but in different order in each row.
Conditions:
1) 15 numbers from 1 to 25 (randomic).
2) The numbers are always in ascending order.
3) There are no duplicates of a number in the same row.
I’d like to detect all possible repeated patterns of numbers and count how many times the sequence appears in the rows.
Pattern: Any repeated combination of at least 7 numbers or more (in sequence or not).
For example I have a matrix as below:
1 4 5 6 7 9 11 12 13 15 16 19 20 23 24
1 4 6 7 8 9 10 11 12 14 16 17 20 23 24
1 2 4 5 8 10 12 13 16 17 18 19 23 24 25
1 2 4 8 9 11 12 13 15 16 19 20 23 24 25
1 2 4 5 6 7 10 12 15 16 17 19 21 23 25
1 4 7 8 10 12 14 15 16 18 19 21 22 23 25
1 5 6 8 9 10 13 15 16 17 18 19 20 22 25
1 2 5 6 7 9 13 14 15 18 19 20 21 23 25
1 2 4 6 8 10 12 15 16 18 19 21 23 24 25
1 2 3 5 6 7 9 13 14 16 17 18 19 20 21
Some patterns found manually:
Sequence = 1 4 12 15 19 23 25
Qty numbers = 7
Count rows = 4
Sequence = 1 5 6 9 13 15 19 20
Qty numbers = 8
Count rows = 3
Sequence = 1 4 6 10 12 16 23
Qty numbers = 7
Count rows = 3
Sequence = 1 2 4 6 10 12 15 16 19 21 23 25
Qty numbers = 12
Count rows = 2
Sequence = 1 2 4 5 10 12 16 17 19 23 25
Qty numbers = 11
Count rows = 2
Is there anything for this in MATLAB?
Thanks in advance!I have a matrix with N rows (N is known) with 15 numbers but in different order in each row.
Conditions:
1) 15 numbers from 1 to 25 (randomic).
2) The numbers are always in ascending order.
3) There are no duplicates of a number in the same row.
I’d like to detect all possible repeated patterns of numbers and count how many times the sequence appears in the rows.
Pattern: Any repeated combination of at least 7 numbers or more (in sequence or not).
For example I have a matrix as below:
1 4 5 6 7 9 11 12 13 15 16 19 20 23 24
1 4 6 7 8 9 10 11 12 14 16 17 20 23 24
1 2 4 5 8 10 12 13 16 17 18 19 23 24 25
1 2 4 8 9 11 12 13 15 16 19 20 23 24 25
1 2 4 5 6 7 10 12 15 16 17 19 21 23 25
1 4 7 8 10 12 14 15 16 18 19 21 22 23 25
1 5 6 8 9 10 13 15 16 17 18 19 20 22 25
1 2 5 6 7 9 13 14 15 18 19 20 21 23 25
1 2 4 6 8 10 12 15 16 18 19 21 23 24 25
1 2 3 5 6 7 9 13 14 16 17 18 19 20 21
Some patterns found manually:
Sequence = 1 4 12 15 19 23 25
Qty numbers = 7
Count rows = 4
Sequence = 1 5 6 9 13 15 19 20
Qty numbers = 8
Count rows = 3
Sequence = 1 4 6 10 12 16 23
Qty numbers = 7
Count rows = 3
Sequence = 1 2 4 6 10 12 15 16 19 21 23 25
Qty numbers = 12
Count rows = 2
Sequence = 1 2 4 5 10 12 16 17 19 23 25
Qty numbers = 11
Count rows = 2
Is there anything for this in MATLAB?
Thanks in advance! I have a matrix with N rows (N is known) with 15 numbers but in different order in each row.
Conditions:
1) 15 numbers from 1 to 25 (randomic).
2) The numbers are always in ascending order.
3) There are no duplicates of a number in the same row.
I’d like to detect all possible repeated patterns of numbers and count how many times the sequence appears in the rows.
Pattern: Any repeated combination of at least 7 numbers or more (in sequence or not).
For example I have a matrix as below:
1 4 5 6 7 9 11 12 13 15 16 19 20 23 24
1 4 6 7 8 9 10 11 12 14 16 17 20 23 24
1 2 4 5 8 10 12 13 16 17 18 19 23 24 25
1 2 4 8 9 11 12 13 15 16 19 20 23 24 25
1 2 4 5 6 7 10 12 15 16 17 19 21 23 25
1 4 7 8 10 12 14 15 16 18 19 21 22 23 25
1 5 6 8 9 10 13 15 16 17 18 19 20 22 25
1 2 5 6 7 9 13 14 15 18 19 20 21 23 25
1 2 4 6 8 10 12 15 16 18 19 21 23 24 25
1 2 3 5 6 7 9 13 14 16 17 18 19 20 21
Some patterns found manually:
Sequence = 1 4 12 15 19 23 25
Qty numbers = 7
Count rows = 4
Sequence = 1 5 6 9 13 15 19 20
Qty numbers = 8
Count rows = 3
Sequence = 1 4 6 10 12 16 23
Qty numbers = 7
Count rows = 3
Sequence = 1 2 4 6 10 12 15 16 19 21 23 25
Qty numbers = 12
Count rows = 2
Sequence = 1 2 4 5 10 12 16 17 19 23 25
Qty numbers = 11
Count rows = 2
Is there anything for this in MATLAB?
Thanks in advance! array, combination MATLAB Answers — New Questions