index exceeds matrix dimension
Info
This question is closed. Reopen it to edit or answer.
Show older comments
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 Comment
Jan
on 6 Aug 2017
You forgot to ask a question.
Answers (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.
This question is closed.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!