I want to solve this problem
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
abduall hassn
il 2 Mag 2015
Modificato: abduall hassn
il 3 Nov 2016
I want find common subsequence numers
0 Commenti
Risposta accettata
John D'Errico
il 2 Mag 2015
This is wildly too confusing of a question. It LOOKS like you are trying to find subsequences of any given array that increment by exactly 1.
That simple requires you to find blocks of ones when you form the diff of an array. Thus...
A=[15,14,16,10,6,1,2,8,9,10];
dA = diff(A) == 1
dA =
0 0 0 0 0 1 0 1 1
So there is a subsequence of length 2 and another of length 3 in string A.
start_A = strfind([0,dA,0],[0 1])
start_A =
6 8
end_A = strfind([0,da,0],[1 0])
end_A =
7 10
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Guidelines for Supported Blocks and Data Type Settings in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!