How to take data on a column matrix (2661 x 1 double) for every 4 row then 3, sequently? So we take data only row 1, 5, 8, 12, 15, 19, 22, ... etc? Thank you.
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Imran Arra'd Sofianto
el 26 de Oct. de 2021
Comentada: Imran Arra'd Sofianto
el 27 de Oct. de 2021
A column matrix!
0 comentarios
Respuesta aceptada
Alan Stevens
el 26 de Oct. de 2021
Here's one way. There's probably a neater way.
data=rand(1,2661);
n = ceil(2661/3.5);
ptr(1)=1;
for i = 2:n
ptr(i) = 4*(mod(i,2)==0) + 3*(mod(i,2)==1) + ptr(i-1);
end
data2 = data(ptr);
Más respuestas (0)
Ver también
Categorías
Más información sobre Matrices and Arrays en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!