Interesting! Now that I fixed that, I get an error that "Index exceeds matrix dimensions" Yet it seems all my dimensions are in order. Wanna try to go 2/2?!
One thing I see right off the bat is you define i=1:w (so this is 1:4608). However in:
h(i)=sum(S4(i,[0:y]));
You are using i to loop through the rows of S4. S4 only has 780 rows not 4608 (the number of columns). I don't know what you are trying to accomplish here but you need to put i in your column index if you want the dimension to not error out. Alternatively, maybe what you want to do is define i=1:l. Again, I don't know what you are trying to accomplish here so try either one based on what you need.
Also, take a look at what Adam commented on your question. I don't know the values of Y(1) or Slope*i but that may also cause problems getting a value of y that is greater than the number of columns you have in S4. However, I do not know for sure and maybe your numbers work out but in any case, the way you have the code set up, "i" is causing the problem above.
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
1 Comment
Direct link to this comment
https://ch.mathworks.com/matlabcentral/answers/289832-subscript-indices-must-either-be-real-positive-integers-error-can-t-figure-out-why#comment_372903
Direct link to this comment
https://ch.mathworks.com/matlabcentral/answers/289832-subscript-indices-must-either-be-real-positive-integers-error-can-t-figure-out-why#comment_372903
Sign in to comment.