Count the number of times a sequence in a matrix repeats

1 view (last 30 days)
Hello I'm trying to create a code that will analyze a matrix and determine if any row in that matrix repeat. Every row has the same size. What I want the code to output is any repeated row in that specific order, and how many times it repeats.I want to be able to do this with an large data set if possible. For example...Here is my matrix. So the output should list repeated row in the order given and the number of times it repeats. Also If I create lets say matrix B and run the same code, I want to be able to compare matrix A and B and see if their is any repeated row between those 2 matricies while still distinguishing the difference between matrix A and B or how ever many matricies I have. Sorry for so much I'm doing really tedious research.
A=[26 33 45 61 68 17 ;
08 13 35 46 68 16 ;
06 07 14 28 59 07 ;
23 45 53 58 62 13 ;
18 24 27 34 60 02 ;
07 31 44 45 55 19 ;
14 19 34 39 59 11 ;
06 13 34 46 62 01 ;
18 34 44 60 69 22 ;
46 54 57 58 66 10 ;
27 32 50 52 57 12 ;
11 44 45 46 70 25 ;
05 11 25 27 64 13 ;
15 16 18 39 59 17 ;
09 38 47 49 68 25 ;
14 39 43 44 67 19 ;
20 36 37 48 67 16 ;
36 43 44 55 68 12 ;
26 29 41 52 64 11 ;
25 28 38 59 62 22 ;
03 15 42 48 56 13 ;
07 10 15 31 57 21 ;
19 22 24 28 53 25 ;
15 25 26 38 47 22 ;
03 09 50 53 64 01 ;
08 10 15 17 57 12 ;
11 15 31 42 63 14 ;
04 18 26 27 58 23 ;
03 24 29 42 47 13 ;
08 22 29 43 56 09 ;
04 44 53 64 70 03 ;
02 22 30 42 62 20 ;
12 35 46 48 69 23 ;
17 20 27 31 34 19 ;
08 33 39 54 58 17 ;
14 25 26 41 43 15 ;
12 13 21 46 57 21 ;
06 26 55 56 64 22 ;
10 15 20 49 53 22 ;
16 20 25 30 43 18 ;
20 40 44 45 50 24 ;
09 16 29 37 53 11 ;
19 33 37 56 57 06 ;
06 20 37 40 48 15 ;
11 34 36 52 66 07 ;
21 23 33 35 42 06 ;
09 14 57 67 70 02 ;
01 05 09 10 23 22 ;
32 35 37 47 55 22 ;
09 20 23 26 29 08 ;
10 13 32 41 51 03 ;
34 52 58 59 62 04 ;
08 10 20 44 46 18 ;
08 19 25 36 66 09 ;
11 17 32 33 46 25 ;
07 16 27 44 52 05 ;
05 20 22 61 70 04 ;
07 13 17 21 45 14 ;
28 30 31 35 66 14 ;
13 19 53 54 63 17 ;
01 27 32 60 67 18 ;
13 15 24 67 70 17 ;
13 35 39 46 55 14 ;
29 47 65 69 70 07 ;
02 11 21 57 60 13 ;
25 33 43 51 68 20 ;
24 38 44 57 58 17 ;
08 17 51 57 70 02 ;
03 25 28 50 60 01 ;
02 08 16 18 31 14 ;
34 35 41 45 54 05 ;
20 27 28 58 59 25 ;
07 22 37 43 44 22 ;
06 17 48 54 69 12 ;
15 48 56 58 70 04 ;
08 12 33 56 64 02 ;
02 03 14 41 64 17 ;
02 09 43 49 63 15 ;
04 07 13 16 60 06 ;
06 12 39 61 70 04 ;
10 32 48 54 55 18 ;
04 06 32 52 64 06 ;
09 14 27 36 52 04 ;
32 48 50 51 64 10 ;
28 31 33 57 62 19 ;
17 36 47 51 62 21 ;
03 04 18 23 38 24 ;
16 18 29 31 37 08 ;
03 25 30 54 70 09 ;
09 11 13 31 47 11 ;
17 27 49 51 66 02 ;
25 40 41 52 56 21 ;
37 41 42 53 63 16];

Answers (1)

Rik
Rik on 21 Nov 2020
Both the unique and ismember functions can handle rows. Look at the respective documentation pages for details.

Categories

Find more on Resizing and Reshaping Matrices in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!