Selecting sequence of data of column vector

1 Ansicht (letzte 30 Tage)
Willemijn Wolf
Willemijn Wolf am 16 Aug. 2016
Bearbeitet: Stephen23 am 16 Aug. 2016
I've got a column vector with length 5000, each row containing a binary results (0 or 1). I need to calculate the sum of the 1st, 6st, 11th, 16th, ... but I don't know how to select those 1st, 6st, 11th, ... datapoints. Can someone help me? Thanks!

Antworten (1)

Stephen23
Stephen23 am 16 Aug. 2016
Bearbeitet: Stephen23 am 16 Aug. 2016
Just use indexing:
sum(vector(1:5:end))
This is very basic MATLAB usage, which is taught well in the introductory tutorials:

Kategorien

Mehr zu Get Started with MATLAB 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