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