MATLAB: Do I receive an error when I use the STD function in MATLAB 7.0 (R14)

flagMATLABnonnegativescalarstdvarweights

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{:}));

Best Answer

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