help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: showing progress of a for loop in a function


From: Steve Thompson
Subject: Re: showing progress of a for loop in a function
Date: Tue, 13 Nov 2007 16:24:14 -0800

Type `help page_screen_output' into the Octave prompt.

On Nov 13, 2007 3:42 PM, novakyu <address@hidden> wrote:
> Hi,
>
> I have a function that executes a fairly time-consuming for loop, and
> I would like to track progress of the loop, so that I know whether to
> interrupt the function call or not
>
> I tried "disp(j)" and "fdisp(j)" (where j is the index I'm looping
> over), but it looks like octave does not print the output until the
> whole function finishes.
>
> Is there any other way to track how many loops it's gone through?
>
> Regards,
>
> Andrzej
>
> P.S. The function looks something like:
> ===
> function [y1 y2] = NSolve(f, t, y1_0, y2_0)
>
> y1 = zeros(size(t));
> y2 = zeros(size(t));
>
> y1(1) = y1_0;
> y2(1) = y2_0;
>
> for j = linspace(1,length(t)-1,length(t)-1)
>   y1(j + 1) = y1(j) + (t(j + 1) - t(j))*f(t)*y2(j)
>   y2(j + 1) = y2(j) + (t(j + 1) - t(j))*f(t)*y1(j)
> endfor
>
> endfunction
> ===
> And for precision issues, I need something around a million iterations
> of the for loop.
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://www.cae.wisc.edu/mailman/listinfo/help-octave
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]