scilab run command or file in another Scilab

## Syntax

    [err, stdout, stderr] = scilab(code, file, mode, quit, args)

    scilab(..., background)

## Arguments

code

  command to execute in the new Scilab.

file

  file to execute in the new Scilab.

mode

  `"nwni"`: to start a new Scilab without graphical and Xcos features.

  `"nw"`: to start a new Scilab with graphical and Xcos features. (default)

quit

  boolean to indicate if Scilab must quit after execution (default: %t)

args

  Other arguments to pass to the new Scilab, they can be retrieved via sciargs.

background

  boolean to indicate that the new Scilab must be launched in a detached process without waiting for end of execution to continue.

  If `background` is `%T` the function will not return any value.

err

  status of execution (0 if succeeded).

stdout

  Content of Standard Output.

stderr

  Content of Standard Error.

## Description

Executes `code` or `file` in a new Scilab and returns status and logs.

## Remarks

`code` and `file` are mutually exclusive.

We recommand to use this function with named arguments (see examples)

## Examples

        //execute 1+1 in a new Scilab and exit at the end
        [status, stdout, stderr] = scilab(code="1+1")
        //execute 1+1 in a new Scilab and exit at the end without graphics
        [status, stdout, stderr] = scilab(code="1+1", mode="nwni")

        tmp = tempname();
        mputl("1+1", tmp);

        //execute 1+1 in a new Scilab and exit at the end
        [status, stdout, stderr] = scilab(file=tmp)
        //execute 1+1 in a new Scilab and exit at the end without graphics
        [status, stdout, stderr] = scilab(file=tmp, mode="nwni")

## See also

- execstr
- exec
- evstr
- sciargs
- Scilab startup options

## History

2024.1.0 `scilab` function introduced