ranges (was Numerical issues with sin()/cos() )

5 messages
Open this post in threaded view
|

ranges (was Numerical issues with sin()/cos() )

 On Wed, 28 Mar 2018, 08:34 Mike Miller, <[hidden email]> wrote: > > > > Actually it's that Octave stores ranges as a (start, step, stop) > triplet. Let's say the value n is the range -16.5:1:16.5 as in your > example. Octave stores that as (start=-16.5, step=1, stop=16.5). On this point, knowing ranges were stored this way I thought recently that the best way to code my problem was:    for ct =1:inf        .        if condition; break        .    end  and was disappointed it did not work. Is there a good reason it does not? Cheers... Ian
Open this post in threaded view
|

Re: ranges (was Numerical issues with sin()/cos() )

 >   for ct =1:inf 1:inf is not valid syntax.  Ranges need finite limits and are expanded to an array as soon as they used, as far as I can tell. -- Francesco Potortì (ricercatore)        Voice:  +39.050.621.3058 ISTI - Area della ricerca CNR          Mobile: +39.348.8283.107 via G. Moruzzi 1, I-56124 Pisa         Skype:  wnlabisti (entrance 20, 1st floor, room C71)     Web:    http://fly.isti.cnr.it
Open this post in threaded view
|

Re: ranges (was Numerical issues with sin()/cos() )

 >>   for ct =1:inf > >1:inf is not valid syntax.  Ranges need finite limits and are expanded >to an array as soon as they used, as far as I can tell. Oh, what you want can be done like this: while true       if condition break; endwhile -- Francesco Potortì (ricercatore)        Voice:  +39.050.621.3058 ISTI - Area della ricerca CNR          Mobile: +39.348.8283.107 via G. Moruzzi 1, I-56124 Pisa         Skype:  wnlabisti (entrance 20, 1st floor, room C71)     Web:    http://fly.isti.cnr.it