[scilab-Users] Question regarding execstr use

Antoine Monmayrant antoine.monmayrant at laas.fr
Fri Nov 5 11:32:11 CET 2010


Le 05/11/2010 11:19, paul.carrico at free.fr a écrit :
> All,
>
> Can somebody tell me why the use of execstr leads to an error (?!?!?) ... I had a look on the help documenttation but ????
>
> Thanks for any advice
>
> Paul
>
>
> // OK
> for i = 1 : 5
>      printf("Hello world %d\n",i)
> end
>
>
> // error
> h = 5;
>
> execstr("for i = 1 : " + string(h))
>      execstr("printf(''Hello world %d\n'',i)")
> execstr("end")
>
> Nota : of course execstr are not necessary in the 2 last lines ... last attempts !
You should not split your "for" loop across 3 execstr.
If you do everything in one execstr, it works:

execstr("for i = 1 : " + string(h)+","+"printf(''Hello world 
%d\n'',i)"+",end")

Antoine




More information about the users mailing list