MATLAB: ‘Array indices should be positive’ error

array indices;

Let's say I'm taking an array of values from an Excel file,
maybe the first column in the excel file and I wanna find the standard deviation for it.
So the code is gonna be
col=a(:,1);
std=std(col);
It gives an output for the first run, but when I run it second time, it gives an error saying,"Array indices should be positive". Why?
Kindly help.
Thanks,
Vinisha.

Best Answer

This is the reason:
std=std(col);
You ‘overshadowed’ the std function by naming your variable ‘std’.
Do this and the problem will go away:
StDev = std(col);
You will have to change that variable in the rest of your code, however the MATLAB Editor should make that easy.