[Scilab-users] Using try and catch

Antoine Monmayrant amonmayr at laas.fr
Tue Apr 9 20:13:37 CEST 2013


 
Le Mardi 9 Avril 2013 17.30 CEST, laurent berger <laurent.berger at univ-lemans.fr> a écrit: 
 
> Hi,
> An example of try and catch for handling execption is 
> clear
> try
> f1= 200;
> A1=1;
> f2=0;
> A2= u;//u is undefined
> catch
>     [str,n,line,func]=lasterror();
>     disp('ERREUR',str)
> end
> 
> Everything is ok but I try 
> clear
> try
> f1= 200;
> A1=1;
> f2=0;
> A2= ;//Nothing on right side of =
> catch
>     [str,n,line,func]=lasterror();
>     disp('ERREUR',str)
> end
> 
> Scilab console is blocked.You have to used ctrlc C and abort. I do  not
> understand why
> Thanks you for your help

Here is how I understand try-catch: it can be used to handle execution error, not syntax error.
In your first example, the syntax is correct, not in the second one.

Hope it helps,

Antoine

> 
> 
> 
> 
> --
> View this message in context: http://mailinglists.scilab.org/Utilisation-de-try-tp4026492p4026493.html
> Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
 
 
 
 




More information about the users mailing list