Save data with different intervals?
Mostrar comentarios más antiguos
I have an array of data and I need to discard the first 7 values, save 15 values and discard other 7 values and keep going until the end of the array.
What is the easiest way to do it? I've tried with a for loop but I don't know how to set the index.
Also, if i want to, let's say, add or subtract a points every 4 repetitions how could I do it? So after 4 times I discard 7 values and save the following 16 values.
Thanks in advance if someone will help me, I'm very stucked.
1 comentario
Below, j1 and j2 are the first and last indexes, respectively, of the data you need to save.
todiscard = 7;
tokeep = 15;
j1 = todiscard+1:tokeep:length(data)-tokeep;
j2 = j1 + tokeep-1;
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Logical en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!