Finding the mean of a matrix row? Get error "Subscript indices must either be real positive integers or logicals."

1 view (last 30 days)
If I have the following matrix as an output from my code;
Xtcounter =
0 4 4 4 0
0 4 4 4 0
0 4 4 4 0
0 4 4 4 0
3 4 4 1 0
2 4 4 2 0
2 4 4 2 0
2 4 4 2 0
2 4 4 2 0
2 4 4 2 0
2 4 4 2 0
2 4 4 2 0
2 4 4 2 0
2 4 4 2 0
2 4 4 2 0
2 4 4 2 0
2 4 4 2 0
2 4 4 2 0
2 4 4 2 0
2 4 4 2 0
2 4 4 2 0
2 4 4 2 0
2 4 4 2 0
2 4 4 2 0
2 4 4 2 0
2 4 4 2 0
2 4 4 2 0
2 4 4 2 0
2 4 4 2 0
2 4 4 2 0
2 4 4 2 0
2 4 4 2 0
2 4 4 2 0
2 4 4 2 0
where each row represents particle's positions along the axis at a time.
I want to find the mean value of each row but it wont let me, I have tried various methods such as
A=Xtcounter(2,:) M=mean(A)
but get the error message;
Subscript indices must either be real positive integers or logicals.
If anyone could help it would be so appreciated!! As i will need to be able to do standard deviation, kurtosis and skewness of each row after!
Thanks in advance!!

Accepted Answer

Mischa Kim
Mischa Kim on 9 Mar 2014
Edited: Mischa Kim on 9 Mar 2014
Use
A = mean(Xtcounter,2)
B = std(Xtcounter,0,2)
C = kurtosis(Xtcounter')'

More Answers (0)

Categories

Find more on Creating and Concatenating Matrices 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!