[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
blocking nested cycles
From: |
octave_user |
Subject: |
blocking nested cycles |
Date: |
Tue, 29 Jun 2010 02:38:44 -0700 (PDT) |
Hi!
I created a function in Matlab, which has a problem. The code is the
following:
==============
for i=1:m
for j=1:n
for jj=1:m
if x(j)<tresholdX(jj) & y(j)<tresholdY(jj)
ET=[ET; i j];
break
end
end
end
end
==============
basically, when the "if" clause in the three nested "for" cycles is
verified, I should skip right to the next "i" values
As it is now programmed, the function only blocks the last "jj" cycle; this
because in Matlab only one "break" command can be used, blocking the
innermost cycle only
Is there any way to get around this problem? Is it possible in Octave to
block more cycles?
In FORTRAN (or even in Basic) there was the "goto" command, by which you
could solve this problem
Any suggestion?
Thanks!
--
View this message in context:
http://octave.1599824.n4.nabble.com/blocking-nested-cycles-tp2271946p2271946.html
Sent from the Octave - General mailing list archive at Nabble.com.
- blocking nested cycles,
octave_user <=