[Scilab-users] Scilab control after an impossible calculation

Mike Page mike.pageone at googlemail.com
Thu Oct 6 12:34:59 CEST 2016


Hi Paul,

Would Scilab's try-catch block do what you want?  For example:

for i=1:10;
   try;
      disp(1/(i-5));
   catch;
      disp("err");
   end;
end

won't crash when it gets to the divide by zero.

This is the more structured way, but you can use execstr with errcatch to
do the same thing.

HTH
Mike.


On 6 October 2016 at 09:51, <paul.carrico at free.fr> wrote:

> Hi All
>
>
>
> I’m using Scilab as the interface between my optimizer and my finite
> element solver(s) and sometimes Scilab stops because of unexpected and
> impossible calculus (1/x with x = 0 as an example ); obviously Scilab stops
> (and so the optimization).
>
>
>
> I’m wondering if it’s possible:
>
> -          To ask back Scilab a message such as “hey I crashed because
> you’re a fool and you’ve not anticipated an impossible calculation !!!”
>
> -          To get back Scilab control in order to avoid optimization
> process crash ? I’ve been thinking in affecting a cost function value at
> %inf for example (not elegant I recognize)
>
>
>
> I don’t know if I’m understandable enough …
>
>
>
> Paul
>
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20161006/6c355dd1/attachment.htm>


More information about the users mailing list