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 Ansicht (letzte 30 Tage)
A column matrix!

Akzeptierte Antwort

Alan Stevens
Alan Stevens am 26 Okt. 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);

Weitere Antworten (0)

Kategorien

Mehr zu Matrices and Arrays finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by