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 `getf("myfile.sci")` before using it.

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

To execute a script file you must use `exec("filename")` in Scilab and in Matlab you just need to type the name of the file.

Scilab comments begins with: `//`

Matlab comments begins with: `%`

Predefined variables usually have the `%` prefix in Scilab (`%i`, `%inf`, ...). 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 are `%T`, `%F` in Scilab and 0, 1 in Matlab. Indexing with boolean variables may not produce same result. Example `x=[1,2];x([1,1])` [which is NOT `x([%T,%T])`] returns `[1,1]` in Scilab and `[1,2]` in Matlab. Also if `x` is a matrix `x(1:n,1)=[]` or `x(:)=[]` is not valid in Matlab.

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

[ ]+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.

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') feof ferror feval evstr and strcat filter rtitr finite (x < %inf) fopen file('open') fread read fseek file ftell fwrite writeb global home isglobal isinf(a) a == %inf isnan(a) a ~= a isstr(a) type(a) == 10 keyboard pause + resume lasterr lookfor apropos more lines pack stacksize pause halt qz gspec+gschur randn rand rem modulo setstr code2str strcmp(a,b) a == b uicontrol uimenu getvalue unix unix_g version which whereis nargin [nargout,nargin]=argn(0) nargout |