Standard deviation of a 3-d matrix

6 views (last 30 days)
hi I have a matrix with size(y)=(200*1*4). I want to calculate the std for each (200*1) vector separately. When I used "std(y(y>0)), it gave me an value but I want in fact 4 values for each 200*1 vector size. How can I write the code to give me the std for each inner vector without "for",and ....
Thanks for your help

Accepted Answer

Kye Taylor
Kye Taylor on 13 Jul 2012
If y is 200-by-1-by-4, you can get rid of the singleton dimension using
y2D = squeeze(y);
then compute the 4 different standard deviations using
the4Sigmas = std(y2D);
  3 Comments
Andrea
Andrea on 13 Jul 2012
Thanks a lot. I've already done that. but a little late. It works perfectly.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!