index exceeds matrix dimension
信息
此问题已关闭。 请重新打开它进行编辑或回答。
显示 更早的评论
Hi i am new and would like some help on this. Appreciate if there is any answers to my question.
NumLoop=100;
ptFreq=[1:8:201];
ISUPPLY=[1:100];
VSUPPLY=[0.00001:0.00001:0.001];
for loop = 1 : NumLoop
I_BLA(loop,:) = ISUPPLY(loop,ptFreq+1)./VSUPPLY(loop,ptFreq+1);
end
1 个评论
Jan
2017-8-6
You forgot to ask a question.
回答(1 个)
E.g. ISUPPLY is a [1 x 100] vector:
ISUPPLY = 1:100;
ISUPPLY(loop, ptFreq+1)
tries to address a matrix with loop as the 1st dimension and ptFreq+1 as 2nd one. This worke only for loop=1 and ptFreq+1 is > 0 and <= 100. But ptFreq is 1:8:201. This means, that both indices are out of range during the loop.
The indexing of arrays is explained in the Getting Started chapters of the documentation exhaustively. Please read it again to understand the basics of Matlab.
0 个评论
此问题已关闭。
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!