[3 1 5 7 0] and [3 2 5 7 0] is similar or not?
'Rows are considered similar if the numbers common to both rows are in the exact same order with no other numbers in between'. Numbers in common are 3, 5, 7. They're in the exact same order. But there is a number in between in both rows, so they're not similar.
Basically, find the numbers that are common to both rows. If they're consecutive in both, with no gaps, keep the row
Maybe a better description for the problem would be that the largest sequence of equal numbers between two rows must have the same size and be unique.
I've added a test to prevent this from working
Return the largest number that is adjacent to a zero
Find relatively common elements in matrix rows
Create a cell array out of a struct
Count up then down
Sum of series VII
compress sequence into intervals
Dispatch and collect
Find the distance between runs
Find the treasures in MATLAB Central and discover how the community can help you!
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office