'Array indices should be positive' error
18 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
采纳的回答
Star Strider
2019-3-12
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.
4 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Import from MATLAB 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!