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"
delete unix('rm file')
eig spec or bdiag
exist exists + type
feval evstr and strcat
finite (x < %inf)
isinf(a) a == %inf
isnan(a) a ~= a
isstr(a) type(a) == 10
keyboard pause + resume
strcmp(a,b) a == b