Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
6.0.0 - English

Change language to:
Français - 日本語 - Português - Русский

Please note that the recommended version of Scilab is 2024.0.0. This page might be outdated.
See the recommended documentation of this function

Scilab Help >> Scilab > scilex | scilab

scilex | scilab

runs Scilab in interactive or batch mode with command line options

Syntax

# MS Windows          |  # Linux / Unix / Mac OS X
wscilex <Options>     |  scilab <Options>
wscilex -nw <Options> |  scilab-adv-cli <Options>
scilex <Options>      |  scilab-cli <Options>

Options

-args arg#1 arg#2 ..

This option allows to send some data to the Scilab session:

  • Consecutive data are separated by one or several spaces.
  • An expression between double-quotes is a single data.
  • To include a double-quote in a data, write \" instead of ".
  • The single quote ' is a regular character. It has no special meaning.

Inside the opened session, these data can be retrieved as separated strings with sciargs().

Example:

C:\Users\Me> scilex -nb -noatomsautoload -args "Hello \"%USERNAME%\"" 1.2345 \"%cd%\"
// Inside the opened session:
a = sciargs()
i = find(a=="-args")
a(i+1)
evstr(a(i+2))*2
"This session has been launched from " + a(i+3)
--> // Inside the opened session:
--> a = sciargs()
 a  =
!c:\SCIdir\bin\scilex  -nw  -nb  -noatomsautoload  -args  Hello "John"  1.2345  "C:\Users\Me" !

--> i = find(a=="-args")
 i  =
    5.

--> a(i+1)
 ans  =
 Hello "John"

--> evstr(a(i+2))*2
 ans  =
    2.469

--> "This session has been launched from " + a(i+3)
 ans  =
 This session has been launched from "C:\Users\Me"

-->

Using -args as the last command line option is safer.

-display Display

For use under Xwindow systems only to set a specific X server display. Default display is unix:0.0.

-display can be abbreviated by -d.

-e Instructions

At the end of the whole session startup, this option

  • sets the current working directory to the shell directory from which Scilab has been launched. Please see the example given here-below for the -f option. Then,

  • executes Scilab Instructions provided in a string. Example:

     scilab-cli -e  "disp(\"Hello\"); a=%pi+%i; disp(exp(a)); exit;" -nb

-e and -f options can't be used together.
-f file

If this option is used, then at the beginning of the Scilab session, after the execution of the scilab and user startup files, and after the setting of user Preferences -- including the working directory ones --,

  • the current Scilab working directory is set to the shell directory from which Scilab has been launched. For instance,

     D:\users\me\scilab\dev> C:\scilab-5.5.2\bin\scilex -f ..\test.sce
    will do a cd("D:\users\me\scilab\dev").

  • the Scilab script file is executed. If a relative path is used (default .\, or like ..\ in the sample here-above), it refers to the new Scilab working directory.

A file with .xcos extension will be opened by Xcos.

-quit

This option forces scilab to always exit after the instruction(s) passed with the -e option, or the script referred to by the -f option, have been executed, even in case of a runtime error. This option should always be used in batch mode. It is ignored if neither -e nor -f options are present.

-l lang

If this option is present it fixes the user language. lang can be: ca_ES de_DE en_US es_ES fr_FR ja_JP pt_BR ru_RU zh_CN zh_TW (from Scilab 5.2).

Other possible lang values are 'fr' for french and 'en' for English for compatibility reasons. The default language is English. This default value is fixed the scilab.start file.

On some systems, locales must be compiled to render correctly UTF-8 fonts.

Scilab can be also called the following way:

 LANG=ja_JP scilab
 # equivalent to
 scilab -l ja_JP
-nb

"no banner": Cancels the display of the Scilab's loading message.

-ns

"No Startup files": Cancels the execution of the main startup file SCI/etc/scilab.start and of the user startup files SCIHOME/.scilab, SCIHOME/scilab.ini.

This option will disable many features in Scilab (Only use if you know what you are doing).

-nouserstartup

Cancels the execution of the user startup files SCIHOME/.scilab and SCIHOME/scilab.ini.

-noatomsautoload

Cancels the autoloading of installed ATOMS modules at startup.

-nw

If this option is present, Scilab is started as command line with advanced features still available (graphics, export, xcos, scinotes, help browser, ...).

From Scilab 5.2:

  • pipes are enabled for all operating systems (see the examples for further details).

  • Scilab distribution also provides a dedicated binary which is doing the same as -nw: scilab-adv-cli (Scilab Advanced Command Line Interpreter).

-nwni / -nogui
This mode prevents loading the Java Virtual Machine. It starts faster and uses less memory. But then...
Scilab is started as command line interpreter without any advanced features requiring the JVM: graphics, export, xcos, scinotes, help browser, other java interfaces, the Java module,... are not available.

Since Scilab 5.2:

  • pipes are enabled for all operating systems (see the examples for further details).

  • Scilab distribution also provides a dedicated binary which is doing the same as -nwni: scilab-cli (Scilab Command Line Interpreter).

--texmacs

This option is reserved for the external TeXMacs module. This one can be priorly installed with atomsInstall('texmacs').

-version

displays the Scilab's version (before the main Scilab's startup).

Additional options for Unix/Linux and Mac OS X

Advice: use theses options on a Scilab source tree.

-debug

Start Scilab under the debugger gdb.

The variable SCILAB_GDB_OPT may be set to add custom options to gdb.

-debug-kdbg

Start Scilab under kdbg.

-profiling

Start Scilab under valgrind.

The variable SCILAB_VALGRIND_OPT may be set to add custom options to valgrind (and override the existing valgrind options).

-profiling-visu

Start Scilab under callgrind.

The variable SCILAB_VALGRIND_OPT may be set to add custom options to callgrind (and override the existing callgrind options).

-electric-fence

Start Scilab with the Electric Fence.

Environment variables

SCIVERBOSE

If this variable is present, Scilab startup script will show a startup debug information. Mainly used for bug report and debugging purposes.

JAVA_HOME

Specify which Java to use. For example, JAVA_HOME=/usr/lib/jvm/java-7-openjdk/ scilab will start Scilab with Java 7.

SCI_DISABLE_TK

Disable Tk (but not Tcl) features.

SCI_JAVA_ENABLE_HEADLESS

Enable Java Headless VM (i.e. without GUI features).

Java Virtual Machine options

The options described here-below are useless and are cancelled if the option -nwni is used.

Starting from Scilab 5.0, the graphical user interface (GUI) and the build documentation are based on Java features. In some cases, it can be important to edit the JVM options (Java Virtual Machine).

These options are available in the jvm_options.xml file.

In version 5.0.X and 5.1.X, this file is stored as SCI/modules/jvm/etc/jvm_options.xml.

In version >= 5.2.0, the file is available in etc/jvm_options.xml.

By default, the three following options are easily accessible in the configuration file:

-XmxXXXm

This option set the amount of memory available by the Java Virtual Machine. By default, 256M are allocated. If you change this value, check that the value does not exceed the memory available on the system.

Since Scilab 5.4.0, this value can be changed in the preferences menu.

-Djava.compiler=JIT

This option with the argument JIT enables the Java Just In Time compiler. It is activated by default. NONE disables the JIT and decreases dramatically performances.

-verbose:jni / -Xcheck:jni

These options enable more checks and output from the JNI calls. These options are useful in case of debugging and are disabled by default since they decreases performances.

Many more options are available. They can improve the performances, change look and feel, change memory managements... See: http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html.

Examples

# Let's start Scilab in profiling mode without attaching a gdb once a SIGSEGV is met.
# We are under Bash shell
export SCILAB_VALGRIND_OPT="--db-attach=no --log-file=myfile.txt"
scilab -profiling

# Let's start Scilab in debug mode without stopping after each SIGSEGV
# First, we write a small command file
echo "handle SIGSEGV nostop" > debug.txt
# Now set the custom option
# We are under Bash shell
export SCILAB_GDB_OPT="--command=debug.txt"
# Start Scilab in debug mode
scilab -debug 

# Under GNU/Linux, Mac OS X or Unix:
$ echo "disp(%pi)"|scilab-cli
or
$ echo "disp(%pi)"|scilab -nwni

# Only open the Scilab help window:
$ scilab-adv-cli -e "help()"
or
$ scilab -nw -e "help()"


# Scilab can be used for scripting aspects:
echo "if 1<>2 then exit(99) end"|scilab-cli
echo $? 

See also

  • startup — startup files
  • sciargs — scilab command line arguments
  • getpid — get Scilab process identificator
  • getenv — get the value of an environment variable
  • getversion — get scilab and modules version information
  • consolebox — show or hide the OS window running Scilab (MS Windows)
  • exit — Ends the current Scilab session

History

VersionDescription
5.4.0 -noatomsautoload added.
5.4.1 scinotes and xcos individual scripts introduced. See SEP #87.
6.0.0 -quit option added. -mem option removed.
Report an issue
<< quit Scilab startup >>

Copyright (c) 2022-2023 (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:
Tue Feb 14 15:02:38 CET 2017