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


Math Forum
»
Discussions
»
Software
»
comp.softsys.matlab
Notice: We are no longer accepting new posts, but the forums will continue to be readable.
Topic:
how to fix subscript indices must either be real positive integers or logicals?
Replies:
4
Last Post:
Aug 28, 2013 2:06 PM



dpb
Posts:
9,850
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.




