[Scilab-users] evaluation of a Scilab expression from Java in the current Scilab environment

Serge Steer Serge.Steer at inria.fr
Thu Jul 25 21:59:22 CEST 2013


Take care that the getvalue function is overloaded by Scilab to silently 
evaluate and chack the arguments that are given by expression based 
variables defined in the Xcos context

Basing your bload dialog on a other function will breaks this behavior...

Serge Steer
INRIA
Le 25/07/2013 10:11, martin.highUp at gmx.net a écrit :
> Hello
> I am writing on an application using Scilab and Xcos. Right now I am 
> working on a specialised replacement for "getvalue(..)" (GUI to edit 
> parameters of Xcos blocks) written in Java.
> Now I need to access the current Scilab workspace (execute an 
> expression and get back the result) from Java -- something like { x = 
> myScilab.getResultFromExpression("2.0*sin(foo)") } with an error 
> message in case of a non-valid expression. Current means that the java 
> code of interest is run through JIMS and shall access its calling 
> Scilab environment.
> Where can I find this functionality?
> What I tried:
> Javasci:
> Used in a separated session it provides roughly the asked 
> functionality. See the example included in Javasci.
> Used within an existing Scilab session I run in some problems.
> The sci.open() does not return when called from within a Scilab 
> session and is probably not needed as there are static methods like 
> Scilab.getInCurrentScilabSession(..), too.
> sci.get(..) is working when I skip sci.open(). Maybe that is the cause 
> for the further problem with sci.execException.
> Scilab.getInCurrentScilabSession("foo") is working (returning a Scilab 
> variables content)  but I found one strange behaviour:
> Scilab.getInCurrentScilabSession("foo * 2") returns the value of foo, 
> not 2*foo and does not thow an Exception. This happens also when 
> called as separate session.
> When called from within a running Scialb session 
> sci.execException("X2C_JAVA_ACCESS = 987")  (or any other valid 
> expression) throws
> org.scilab.modules.javasci.JavasciException$ScilabErrorException: A 
> Scilab error occurred: winqueryreg: Cannot query value of this type.
> Code: 999
>
> and called one more time:
> org.scilab.modules.javasci.JavasciException$ScilabErrorException: A 
> Scilab error occurred: Method invocation: An error occurred during the 
> data retrieving in Java:An exception has been thrown in calling the 
> method 
> getValueFromExpression_1:org.scilab.modules.javasci.JavasciException$ScilabErrorException: 
> A Scilab error occurred: winqueryreg: Cannot query value of this 
> type.Code: 999
> Code: 999
> In a separate session as in the Javasci example that works.
>
> Do you have hints where to dig to get something like 
> getResultFromExpression("2.0*sin(foo)") working?
> Thanks
> Martin
>
>
> _______________________________________________
> 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/20130725/7237876b/attachment.htm>


More information about the users mailing list