Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.


dpb
Posts:
8,716
Registered:
6/7/07


Re: how to fix subscript indices must either be real positive integers or logicals?
Posted:
Aug 28, 2013 1:49 PM


On 8/28/2013 12:18 PM, p v bhumireddi wrote: > im new to matlab.im executing program and im getting repeatedly the > above mentioned error > my code is w=[2:5]; > int=0; > for k=1:w > e(int)=[exp(i*k) exp(2*i*k)]; > int=int+1; > end can anyone help me.urgent
What's the value of 'int' the first pass thru when it is used as the index to the array e? Matlab arrays are 1based.
One line of code rearrangement will resolve that problem at which time you'll discover a few more.
for k=1:w
won't return what you expect
doc for
for why and how to correct it.




