- #1
Jan Skacel
- 3
- 0
Hi :)
I need to program several nested 'for' loops which differs only in index of their variables inside.
So I need to convert this:
into some smart one 'for-loop'. The number of for loops is determined by number of vectors, or rather number of columns in matrix "A" specified prior to the loop.
I'm guessing there should be some array trick instead of indexes i1, i2, in. Something like for A(1,: ) :1000:-d:0.
Or should I somehow call function each time?
Thank you so much
I need to program several nested 'for' loops which differs only in index of their variables inside.
So I need to convert this:
for i1 = 1000:-d:0
for i2 = (1000-(d*i1):-d:0
end...
for in = (1000-(d*in-1):-d:0
some function containing all index variables like:
b=(i1*A( :,2), i2*A( :,3), ... in*A( :,n))
c=b/a
d=min(c)
if d<e
e=d
endend
endfor in = (1000-(d*in-1):-d:0
some function containing all index variables like:
b=(i1*A( :,2), i2*A( :,3), ... in*A( :,n))
c=b/a
d=min(c)
if d<e
e=d
end
into some smart one 'for-loop'. The number of for loops is determined by number of vectors, or rather number of columns in matrix "A" specified prior to the loop.
I'm guessing there should be some array trick instead of indexes i1, i2, in. Something like for A(1,: ) :1000:-d:0.
Or should I somehow call function each time?
Thank you so much