Azzera filtri
Azzera filtri

Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

Help and account substrings extraction

2 visualizzazioni (ultimi 30 giorni)
FRANCISCO
FRANCISCO il 10 Dic 2013
Chiuso: MATLAB Answer Bot il 20 Ago 2021
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

Risposte (0)

Questa domanda è chiusa.

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by