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 visualizzazione (ultimi 30 giorni)
A column matrix!

Risposta accettata

Alan Stevens
Alan Stevens il 26 Ott 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);

Più risposte (0)

Categorie

Scopri di più su Matrices and Arrays in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by