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 view (last 30 days)
Show older comments
Imran Arra'd Sofianto
on 26 Oct 2021
Commented: Imran Arra'd Sofianto
on 27 Oct 2021
A column matrix!
0 Comments
Accepted Answer
Alan Stevens
on 26 Oct 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);
More Answers (0)
See Also
Categories
Find more on Matrices and Arrays in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!