What is Scilab

What are the main differences between Scilab and MATLAB?


Functions in Scilab are NOT Matlab m-files but variables. One or several functions can be defined in a single file (say myfile.sci). The name of of the file is not necessarily related to the the name of the functions. The name of the function(s) is given by

function [y]=fct1(x) ... function [y]=fct2(x) ...

The function(s) are not automatically loaded into Scilab. Usually you have to execute the command before using it.

Functions can also be defined on-line (or inside functions) by the command .

To execute a script file you must use in Scilab and in Matlab you just need to type the name of the file.

Comment lines

Scilab comments begins with:

Matlab comments begins with:


Predefined variables usually have the prefix in Scilab (, , ...). They are write protected.


Strings are considered as 1 by 1 matrices of strings in Scilab. Each entry of a string matrix has its own length.

Boolean variables

Boolean variables are , in Scilab and 0, 1 in Matlab. Indexing with boolean variables may not produce same result. Example [which is NOT ] returns in Scilab and in Matlab. Also if is a matrix or is not valid in Matlab.


Polynomials and polynomial matrices are defined by the function in Scilab (built-in variables). They are considered as vectors of coefficients in Matlab.

Empty matrices

[ ]+1 returns 1 in Scilab and [ ] in Matlab.


Except for the simple plot and mesh (plot3d) functions, Scilab and Matlab are not compatible


Scicos (Scilab) and Simulink (Matlab) are not compatible.

A dictionary

Most built in functions are identical in Matlab and Scilab. Some of them have a slightly different syntax. Here is a brief, partial list of commands with significant different syntax.

Matlab Scilab "equivalent"

all and

any or

balance balanc

clock unix('date')

computer unix_g('machine')

cputime timer

delete unix('rm file')

dir unix_g('ls')

echo mode

eig spec or bdiag

eval evstr

exist exists + type

fclose file('close')



feval evstr and strcat

filter rtitr

finite (x < %inf)

fopen file('open')

fread read

fseek file


fwrite writeb




isinf(a) a == %inf

isnan(a) a ~= a

isstr(a) type(a) == 10

keyboard pause + resume


lookfor apropos

more lines

pack stacksize

pause halt

qz gspec+gschur

randn rand

rem modulo

setstr code2str

strcmp(a,b) a == b


uimenu getvalue

unix unix_g


which whereis

nargin [nargout,nargin]=argn(0)