Borrar filtros
Borrar filtros

Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Help and account substrings extraction

2 visualizaciones (últimos 30 días)
FRANCISCO
FRANCISCO el 10 de Dic. de 2013
Cerrada: MATLAB Answer Bot el 20 de Ag. de 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

Respuestas (0)

La pregunta está cerrada.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by