Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
5.3.0 - Português

Change language to:
English - Français - 日本語 -

Please note that the recommended version of Scilab is 2025.0.0. This page might be outdated.
However, this page did not exist in the previous stable version.

Manual Scilab >> Interface Java > Javasci v1 (deprecated) > javasci.Scilab (deprecated)

javasci.Scilab (deprecated)

This class provides the basic methods to execute Scilab code and scripts. Deprecated: Please use Javasci v2

Description

This class is static. Since the Scilab environnement is persistant, all variables will remain accessible with the Java application.

Method Summary :

  • public static void Events() - Execute a Scilab event

  • public static boolean HaveAGraph() -Check if there is any scilab graphic window open (return True if it is the case).

  • public static boolean Exec(String job) - Execute a job in scilab. return true if there is no error.

    Note that the given expression must be consistent by itself. Then, a serie of Exec defining a function will not work. Please consider calling it with a single string instruction or using a temporary file with the method ExecuteScilabScript.

    For example: Scilab.Exec("function foo(); disp('bar'); endfunction"); will work when Scilab.Exec("function foo();"); Scilab.Exec("disp('bar');"); Scilab.Exec("endfunction;"); will not work since each statement being processed independently

  • public static native boolean ExistVar(String VarName)- Detect if VarName exists in Scilab. return true if Varname exist.

  • public static native int TypeVar(String VarName) - Return Scilab type of VarName. See type

  • public static native int GetLastErrorCode() - Return last Error code. See lasterror

  • public static boolean ExecuteScilabScript(String scilabscriptfilename)- Execute a scilab script (.sce) return true if there is no error.

  • public static native boolean Finish() - Terminate scilab (call scilab.quit , close a scilab object)

Examples

// A Scilab / Java example 
// Filename: ScilabExample.java

import javasci.Scilab;

public class ScilabExample {
    public static void main(String []args){
        String myVar="myVariable";
        Scilab.Exec(myVar+"=(%pi^4)/90;disp(myVariable);"); // Simple display
        if (Scilab.ExistVar(myVar)) {
            System.out.println("Variable "+myVar+" exists. Type: "+Scilab.TypeVar(myVar));
        }
        if (!Scilab.Exec("disp(plop);")) { // Error
            System.err.println("Last error: "+Scilab.GetLastErrorCode()); // Error
        }
        Scilab.Finish();
    }
}

Authors

A.C

<< javasci.SciStringArray (deprecated) Javasci v1 (deprecated) Compile and run with javasci v1 >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Wed Jan 26 16:24:43 CET 2011