Matlab: Refer to multiple, non consecutive elements
<p>In Matlab is there any way to refer to multiple, non consecutive elements in a 1 dimensional array in the same line, eg. something like:
<code>mean(strength(1:4,17:20))</code>
I want to calculate the mean of 1st to 4th elements and the 17th to 20th elements in an array called <code>strength</code> etc. Except obviously a comma wouldn't work, because that would be double indexing, as if it was a matrix, when it's 1D. Is there another symbol you could use in place of the comma to do this, or would you need another technique to do this?</p>