a question about coding OCTAVE

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

a question about coding OCTAVE

mohammad aminpanah
Hello
When I define a for LOOP starting with a negative point or ending a negative point, an error will appear reciting that I cannot start or end the loop with negative numbers. What should I do?

In advance, thank you for your consideration and help.
With Gratitude
Mohammad Aminpanah
M.Sc of geophysics


Reply | Threaded
Open this post in threaded view
|

Re: a question about coding OCTAVE

Dmitri A. Sergatskov
On Wed, Oct 2, 2019 at 3:34 PM mohammad aminpanah
<[hidden email]> wrote:
>
> Hello
> When I define a for LOOP starting with a negative point or ending a negative point, an error will appear reciting that I cannot start or end the loop with negative numbers. What should I do?
>
> In advance, thank you for your consideration and help.
> With Gratitude
> Mohammad Aminpanah
> M.Sc of geophysics
>

Works for me:

octave:1> for ii=-10:-1 disp(ii) endfor
-10
-9
-8
-7
-6
-5
-4
-3
-2
-1

Regards,

Dmitri.
--