필터 지우기
필터 지우기

I want to solve this problem

조회 수: 1 (최근 30일)
abduall hassn
abduall hassn 2015년 5월 2일
편집: abduall hassn 2016년 11월 3일
I want find common subsequence numers

채택된 답변

John D'Errico
John D'Errico 2015년 5월 2일
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
  댓글 수: 1
abduall hassn
abduall hassn 2015년 5월 5일
Thank u brother but what result u got that not my tension i select sub sequence on two numbers and in three numbers like 1,2 ,8,9 this is two sub sequence and 8,9,10 this is three sub sequence
and thank u

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

태그

아직 태그를 입력하지 않았습니다.

제품

Community Treasure Hunt

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

Start Hunting!

Translated by