[scilab-Users] variables from TCL in Scilab

marcin.wozniczka Gazeta.pl marcin.wozniczka at gazeta.pl
Fri Mar 26 20:00:16 CET 2010


Hello,

I have one more problem with transfer variables from TCL to Scilab and from
Scilab to TCL. In Tcl I have several entries field in which name of
variables are nr$i (where $i are following numbers). Example of this
function in TCL is below:

*for {set i 1} {$i <= ($::npkt)} {incr i} {*
*  pack [entry .pol.n.nr$i -width 7 -justify right -textvariable nr$i
-validate key -vcmd {expr {[string is double %P] && ![string match ""0*""
%P] && [string len %P] <=7}}]*
*}*

>
So if I have *npkt = 5* I should have 5 variables call *nr1*, *nr2*, *nr3* i
*nr4*. So I created in Scilab function which should import this variables:

*function []=calc()*
*n=evstr(TCL_GetVar("npkt"));*
*for i=1:n*
*    b ="nr''+string(i)      //name of variables in TCL*
*    nr_pkt(i)=evstr(TCL_GetVar("b"));*
*end*
*endfunction*
*
*
After executed program inScilab and used this finctionI have information:
* !--error 999 *
*TCL_GetVar: Could not read Tcl Variable.*
*at line      14 of function liczpol called by :  *
*liczpol()*
*while executing a callback*
*
*
Could anyone know what is wrong with this function?

And I have question about second function which should return calculated
variables to TCL. Is this function is write correctly?
*function []=result()*
*n=evstr(TCL_GetVar("nrxp"));*
*for i=1:n*
*  x
='xp'+string(i)     //name of variables in TCL
*
*

TCL_SetVar("x",r(i))   //r(i) are results
*
*end*
*endfunction*

Could you tell me where is mistake in my function, and what can I do with it
to fix it?
Marcin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20100326/e5e8b366/attachment.htm>


More information about the users mailing list