How can I get specified elements of matrix?
Show older comments
I have a 1*28800 matrix and I want elements of this matrix which indexes are 10*i+1. How can I get these specified matrix?
for example
a=[1,2,3,4,5,7,8,910,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30]
I want a(1),a(11),a(21)
How can I code this in matlab?
1 Comment
Torsten
on 21 Aug 2022
Better use
a=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30]
instead of
a=[1,2,3,4,5,7,8,910,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30]
to check
a(1:10:end)
Answers (1)
Bruno Luong
on 21 Aug 2022
a(1:10:end)
Categories
Find more on Matrix Indexing 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!