필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Help and account substrings extraction

조회 수: 2 (최근 30일)
FRANCISCO
FRANCISCO 2013년 12월 10일
마감: MATLAB Answer Bot 2021년 8월 20일
good, I wish to raise my problem, because I know how to do. I, for example have a long string as follows:
[3 -1 -1 -1 -1 -1 1 -1 -1 -1 0 -1 -1 -1 -1 4 -1 0 -1 -1 -1 0 -1 -1 3 -1 -1 -1 -1 -1 -1 4 -1 -1 0
-1 1 -1 -1 -1 0 -1 1 -1 -1 -1 -1 -1 -1 1 -1 0 -1 -1 4……..
What I want to do is the following:
1) extracting substrings so that starts for next 3/4 and ends 3/4 including the upcoming latter. For example:
[-1 -1 -1 -1 -1 1 -1 -1 -1 0 -1 -1 -1 -1 4]
Next substring;
[-1 0 -1 -1 -1 0 -1 -1 3]
Next substring;
[-1 -1 -1 -1 -1 -1 4]
And so on
2nd) I have to count occurrences of a given substring and also recounting the lengths associated with each substring:
For example we have:
a) [-1 -1 -1 1 -1 0 -1 4]
b) [-1 0 -1 -1 1 4]
SUBSECUENCE__________________REPETITIONS__________Nº(-1)
1 0 4 ----------------------------------------------------2---------------------------------5
1 0 4 ----------------------------------------------------2---------------------------------3
(Note: subsecuence is obtained by eliminating (-1))
We see that the pattern [1 0 4] repeats in a) and b) therefore is repeated twice. In a) there are 5 (-1). In b) there are 3 (-1). How could I make? I do not know how to do.
thank you very much

답변 (0개)

이 질문은 마감되었습니다.

제품

Community Treasure Hunt

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

Start Hunting!

Translated by