[Scilab-users] ?==?utf-8?q? ?==?utf-8?q? ?= How to replicate what "load" does (aka creating variable in the current workspace from inside a function)
Antoine Monmayrant
amonmayr at laas.fr
Mon Feb 22 12:39:57 CET 2016
Hi all,
For information, I found a solution that works fine in both 5.5.X and 6.0.X:
function myload()
txt=["a=1";"b=2"];
execstr(txt);//load local variables defined in txt;
//build comma separated list of variables in txt
csvar=strsubst(txt,'/=.*/',',','r').';
csvar=part(strcat(csvar),1:$-1);
//return local variables to the calling environment
execstr("["+csvar+"]=resume("+csvar+")");
endfunction
Thank you Serge for your kind help.
TIL that scilab has a 'resume' function.
Cheers,
Antoine
More information about the users
mailing list