I am trying to calculate a column of means from a 2-D matrix. The length of the mean is equally to the number of rows of the matrix.
However, the index to each row is different. For example, row 1 I want the mean of colums 4 to 8. Row 2 I want the means of columns 3 to 5.
I have tried
Where VariableIndex1 and VariableIndex2 are columns for the start and end indices of the columns I need means from
For the example above this would be:
- but this seems to give a non-sensical result.
Any thoughts or advice on how to do this? The column acutally has 100 000 rows so I don't want to loop through it.