Why do I receive an error when I use the STD function in MATLAB 7.0 (R14)?

29 views (last 30 days)
I use the STD function to evaluate the standard deviation of my data, using the following code:
X=[4 -2 1 9 5 7];
std(X,2)
which generates the following error:
??? Error using ==> var
W must be a vector of nonnegative weights, or a scalar 0 or 1.
Error in ==> std at 32
y = sqrt(var(varargin{:}));

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
The STD function has been changed between MATLAB 6.5.1 (R13SP1) and MATLAB 7.0 (R14).
In MATLAB 7.0 (R14), the second input argument ("flag") must be either 0 or 1 as stated in the documentation. To view the documentation for the STD function, use the following command:
doc std

More Answers (0)

Categories

Find more on Get Started with MATLAB in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!