Foreword
|
This document contains a list of some Matlab basis functions and compare them
with the Scilab equivalent functions if there are. It gives the main differences
and gives examples of particular cases.
However not all Matlab and Scilab functions are described here.
Equivalents for operators and variables can be found at the end of this document.
Caution:
This document is not dedicated to explain how functions work.
Users can used online manuals of Matlab and Scilab for it.
How to use this HTML guide:
To have more details about functions and examples, clic on the "triangles" just
at the left of Matlab function name.
To have a more detailed index, clic on the letters and keywords.
|
|
|
|
|
Matlab |
A |
 |
|
|
|
abs |
Absolute value and complex magnitude |
abs |
|
|
|
|
acosh |
Inverse hyperbolic cosine |
acosh |
|
|
|
acoth(A) |
Inverse hyperbolic cotangent |
atanh(1 ./A) |
|
| In Matlab y=acoth(x) and Scilab y=atanh(1 ./x), for real elements of x outside the domain [-1,1], the complex part of Scilab y value is the opposite of Matlab y value. See atanh/. |
|
|
|
|
acot(A) |
Inverse cotangent |
atan(1 ./A) |
|
|
|
|
acsch(A) |
Inverse hyperbolic cosecant |
asinh(1 ./A) |
|
|
|
|
acsc(A) |
Inverse cosecant |
asin(1 ./A) |
|
|
|
all |
Test to determine if all elements are nonzero |
and |
|
Matlab all function can work with complexes, what Scilab and can not, so a call to abs function can be necessary when translating from Matlab to Scilab. ▹ B=all(A) ↔ B=and(A): If A is a matrix, all(A) is equivalent to all(A,1) in Matlab whereas in Scilab and(A) is a logical AND of all elements of A. If A is a multidimensional array then Matlab treats the values along the first non-singleton dimension, but Scilab returns logical AND of all elements of A. ▹ B=all(A,dim) ↔ B=and(A,dim): In Scilab dim=1 is equivalent to dim=''r'' and dim=2 is equivalent dim=''c''. In Matlab, dim can be greater then the number of dimension of A (in this case, B=A), in Scilab you will get an error message. |
y = all([1,1,0;1,0,1]) y = [1,0,0] y = all([1,1,0;1,0,1],1) y = [1,0,0]
|
y = and([1,1,0;1,0,1]) y = %F y = and([1,1,0;1,0,1],1) y = [%T,%F,%F]
|
|
|
|
|
angle(A) |
Phase angle |
atan(imag(A),real(A)) |
|
|
|
any |
Test to determine if any nonzeros elements |
or |
|
Matlab any function can work with complexes, what Scilab or can not, so a call to abs function can be necessary when translating from Matlab to Scilab. ▹ B=any(A) ↔ B=or(A): If A is a matrix, any(A) is equivalent to any(A,1) in Matlab whereas in Scilab or(A) is a logical OR of all elements of A. If A is a multidimensional array then Matlab treats the values along the first non-singleton dimension, but Scilab returns logical OR of all elements of A. ▹ B=any(A,dim) ↔ B=or(A,dim): In Scilab dim=1 is equivalent to dim=''r'' and dim=2 is equivalent dim=''c''. In Matlab, dim can be greater then the number of dimension of A (in this case, B=A), in Scilab you will get an error message. |
y = any([1,1,0;1,0,1]) y = [1,1,1] y = any([1,1,0;1,0,1],1) y = [1,1,1]
|
y = or([1,1,0;1,0,1]) y = %T y = or([1,1,0;1,0,1],1) y = [%T,%T,%T]
|
|
|
|
|
asech(A) |
Inverse hyperbolic secant |
acosh(1 ./A) |
|
|
|
|
asec(A) |
Inverse secant |
acos(1 ./A) |
|
|
|
|
asinh |
Inverse hyperbolic sine |
asinh |
|
|
|
asin |
Inverse sine |
asin |
|
| In y=asin(x), for real elements of x outside the domain [-1,1], the complex part of Scilab y value is the opposite of Matlab y value. |
y = asin(2) y = 1.5708 - 1.3170i
|
y = asin(2) y = 1.5708 + 1.3170i
|
|
|
|
atan2 |
Four-quadrant inverse tangent |
atan2 |
|
| Matlab atan2 function can work with complexes (in this case, complex part is ignored), what Scilab atan can not. |
|
|
|
atanh |
Inverse hyperbolic tangent |
atanh |
|
| In y=atanh(x), for real elements of x outside the domain [-1,1], the complex part of Scilab y value is the opposite of Matlab y value. |
y = atanh(2) y = 0.5493 + 1.5708i
|
y = atanh(2) y = 0.5493061 - 1.5707963i
|
|
|
|
|
atan |
Two-quadrant inverse tangent |
atan |
|
|
|
|
|
Matlab |
B |
 |
|
|
balance |
Diagonal scaling to improve eigenvalue accuracy |
balanc |
|
There is no equivalent for B=balance(A) in Scilab, balanc function does not work with only one output value. When used with two outputs, these functions return value in inverse order. |
[T,Ab] = balance(A)
|
[Ab,T] = balanc(A)
|
|
|
|
|
barh |
Bar histogram horizontal |
barh |
|
|
|
beep |
Produce a beep sound |
beep |
|
| Scilab beep always returns a value but not Matlab function. |
|
|
|
besseli |
Modified Bessel functions of the first kind |
besseli |
|
| Scilab besseli function can work with only one output argument, but the Matlab function can work with two outputs arguments. |
y = besseli(alpha,x) y = besseli(alpha,x,1) [y,ierr] = besseli(alpha,...)
|
y = besseli(alpha,x) y = besseli(alpha,x,ice),ice = 1 or ice = 2
|
|
|
|
besselj |
Bessel functions of the first kind |
besselj |
|
| Scilab besselj function can work with only one output argument, but the Matlab function can work with two outputs arguments. |
y = besselj(alpha,x) y = besselj(alpha,x,1) [y,ierr] = besselj(alpha,...)
|
y = besselj(alpha,x) y = besselj(alpha,x,ice),ice = 1 or ice = 2
|
|
|
|
besselk |
Modified Bessel functions of the second kind |
besselk |
|
| Scilab besselk function can work with only one output argument, but the Matlab function can work with two outputs arguments. |
y = besselk(alpha,x) y = besselk(alpha,x,1) [y,ierr] = besselk(alpha,...)
|
y = besselk(alpha,x) y = besselk(alpha,x,ice),ice = 1 or ice = 2
|
|
|
|
bessely |
Bessel functions of the second kind |
bessely |
|
| Scilab bessely function can work with only one output argument, but the Matlab function can work with two outputs arguments. |
y = bessely(alpha,x) y = bessely(alpha,x,1) [y,ierr] = bessely(alpha,...)
|
y = bessely(alpha,x) y = bessely(alpha,x,ice),ice = 1 or ice = 2
|
|
|
|
beta |
Beta function |
beta |
|
| Matlab beta function can work with only one scalar input an done not-scalar input parameter, but in Scilab both parameters must have the same size. |
A = 1; B = [1 2 3]; Y = beta(A,B);
|
A = 1; B = [1 2 3]; // So that A and B have the same size tmp = A;A = B;A(:) = tmp; Y = beta(A,B);
|
|
|
|
|
bin2dec |
Returns the integer corresponding to a Given binary representation |
bin2dec |
|
|
|
|
bitand |
The AND of two integers |
bitand |
|
|
|
|
bitcmp |
The binary complementary of an integer |
bitcmp |
|
|
|
|
bitget |
Gets the bit of an integer whose the positon is given in the input argument |
bitget |
|
|
|
|
bitor |
The OR of two integers |
bitor |
|
|
|
|
bitxor |
Returns the exclusive OR of two integers |
bitxor |
|
|
|
blanks |
A string of blanks |
No equivalent |
|
| There is no Scilab equivalent function for Matlab box but it can be easyly replaced by Scilab equivalent instructions. |
A = ['xxx' blanks(20) 'yyy'];
|
A = "xxx"+part(" ",ones(1,20))+"yyy";
|
|
|
|
box |
Display axes border |
No equivalent |
|
| There is no Scilab equivalent function for Matlab box but it can be easyly replaced by Scilab equivalent instructions. |
box on box off box box(h,'on') box(h,'off') box(h)
|
a = gca(); a.box = "on"; a.box = "off"; if a.box=="on" then a.box="off";else a.box="on";end; h.box = "on"; h.box = "off"; if h.box=="on" then h.box="off";else h.box="on";end;
|
|
|
|
|
break |
Terminate execution of a for loop or while loop |
break |
|
|
|
|
|
Matlab |
C |
 |
|
|
case |
Case switch |
case |
|
| In Matlab expression evaluated can be a cell, in this particular use, all values of cell are considered individually (similarly to a OR). In Scilab it can not be a cell (Matlab particularity can be replaced by others "case" or all switch/case statement can be replaced by a if/then/else statement.). |
|
|
|
|
cat |
Arrays concatenation |
cat |
|
|
|
cd |
Change/get working directory |
cd |
|
| Note that cd .. does not work in Scilab, but it does in Matlab. In Scilab you can use cd(".."). |
|
|
|
|
cell2mat |
Convert a cell array into a matrix |
cell2mat |
|
|
|
|
cellstr |
Convert strings vector (or strings matrix) into a cell of strings |
cellstr |
|
|
|
cell |
Create cell array |
cell |
|
| Note that in Matlab, input can contain complex values (in these cases, only real part of it is taken in account), what Scilab function do not tolerate. |
|
|
|
chol |
Cholesky factorization |
chol |
|
| Scilab chol function can only have one output whereas Matlab one can have two ouputs. |
|
|
|
cla |
Clear current axes |
No equivalent |
|
▹ cla: Scilab equivalent could be a = gca();delete(a.children); but in this case, all current axes children will be deleted because there is no HandleVisibility property in Scilab graphics. ▹ cla reset: Scilab equivalent is a = gca();delete(a.children);. |
|
|
|
clc |
Clear Command Window |
clc([nblines]) |
|
Note that Scilab function allows to clear only a set of lines above the cursor using clc(nblines). Note that Scilab function can not be used in no window mode under Unix/Linux while Matlab one clears the terminal display as if you were using "clear" command. |
|
|
|
clear |
Remove items from workspace, freeing up system memory |
clear |
|
Scilab and Matlab clear functions are only equivalent when called using clear or clear name. ▹ clear global ...: Scilab equivalent for Matlab clear global [name] is clearglobal([name]). ▹ clear variables ...: Scilab equivalent for Matlab clear variables is simply clear. ▹ clear keyword ...: For all other keywords, there is no Scilab equivalent for Matlab clear call. |
|
|
|
clf |
Clear current figure window |
clf |
|
▹ clf: In this case, all current figure children will be deleted because there is no HandleVisibility property in Scilab graphics. ▹ fig_handle = clf: Scilab equivalent is be fig_handle = gcf();clf;. In this case, all current figure children will be deleted because there is no HandleVisibility property in Scilab graphics. |
|
|
|
clock |
Current time as a date vector |
No equivalent |
|
| Even if there no equivalent for Matlab clock in Scilab, it can be emuled as shown in example. |
c = clock
|
w = getdate(); w(3:5) = []; w(6) = w(6)+w(7)/1000; c = w(1:6);
|
|
|
|
|
closereq |
Default figure close request function |
delete(gcf()) |
|
|
|
close |
Delete specified figure |
close ↔ xdel ↔ delete |
|
▹ close: If current figure is a uicontrol one, Scilab and Matlab close are equivalent. But if current figure is a graphic window, Scilab equivalent for Matlab close is delete(gcf()). ▹ close(h): If h is a uicontrol figure, Scilab and Matlab close(h) are equivalent. But if h is a graphic window, Scilab equivalent for Matlab close(h) is delete(h). ▹ close('all'): Scilab equivalent for Matlab close('all') is xdel(winsid()). ▹ close(name): There is no Scilab equivalent for Matlab close(name) however, mtlb_close can be an equivalent. ▹ close('all','hidden'): Scilab equivalent for Matlab close('all','hidden') is xdel(winsid()) but Scilab kills all figures even if they are hidden. |
|
|
|
colordef |
Set default property values to display different color schemes |
No equivalent |
|
▹ [h = ]mtlb_colordef(color_option): Scilab equivalent is fig = gcf();fig.background = -1;[h = fig]; if color_option is equal to "black" or "none" and fig = gcf();fig.background = -1;[h = fig]; else. ▹ [h = ]mtlb_colordef(fig,color_option): Considering fig is a graphics handle, Scilab equivalent is fig.background = -1;[h = fig]; if color_option is equal to "black" or "none" and fig.background = -2;[h = fig]; else. ▹ [h = ]mtlb_colordef('new',color_option): Scilab equivalent is fig=scf(max(winsid())+1);fig.background = -1;[h = fig]; if color_option is equal to "black" or "none" and fig=scf(max(winsid())+1);fig.background = -2;[h = fig]; else. |
|
|
|
|
complex |
Returns the complex form corresponding to the given real part and imaginary part |
complex |
|
|
|
|
conj |
Complex conjugate |
conj |
|
|
|
|
continue |
Keyword to pass control to the next iteration of a loop |
continue |
|
|
|
conv |
Convolution |
convol |
|
Scilab convol output value is always a row vector while Matlab conv output value is a column vector if at least one input is a column vector. To have a closer result, replace Matlab conv(A) by clean(convol(A)) in Scilab. |
|
|
|
|
cosh |
Hyperbolic cosine |
cosh |
|
|
|
|
coth |
Hyperbolic cotangent |
coth |
|
|
|
|
cputime |
Elapsed CPU time |
timer() |
|
|
|
|
csch(A) |
Hyperbolic cosecant |
1 ./sinh(A) |
|
|
|
|
csc(A) |
Cosecant |
1 ./sin(A) |
|
|
|
cumprod |
Cumulative product |
cumprod |
|
▹ C = cumprod(A): If A is a matrix, cumprod(A) is equivalent to cumprod(A,1) in Matlab whereas in Scilab cumprod(A) gives the cumulative product of all the entries of A taken columnwise. Actually, Matlab works on the first non-singleton dimension and Scilb does not. ▹ C = cumprod(A,dim): Matlab can work with dim greater than number of dimensions of A but Scilab can not, in this can use mtlb_cumprod instead. |
B = cumprod([1,2,3;4,5,6]) B = [1,2,3;4,10,18] B = cumprod([1,2,3;4,5,6],1) B = [1,2,3;4,10,18]
|
B = cumprod([1,2,3;4,5,6]) B = [1,8,120;4,40,720] B = cumprod([1,2,3;4,5,6],1) B = [1,2,3;4,10,18]
|
|
|
|
cumsum |
Cumulative sum |
cumsum |
|
▹ C=cumsum(A): If A is a matrix, cumsum(A) is equivalent to cumsum(A,1) in Matlab whereas in Scilab cumsum(A) gives the cumulative sum of all the entries of A taken columnwise. Actually, Matlab works on the first non-singleton dimension and Scilb does not. ▹ C = cumsum(A,dim): Matlab can work with dim greater than number of dimensions of A but Scilab can not, in this can use mtlb_cumsum instead. |
B = cumsum([1,2,3;4,5,6]) B=[1,2,3;5,7,9] B = cumsum([1,2,3;4,5,6],1) B=[1,2,3;5,7,9]
|
B = cumsum([1,2,3;4,5,6]) B=[1,7,15;5,12,21] B = cumsum([1,2,3;4,5,6],1) B=[1,2,3;5,7,9]
|
|
|
|
|
|
Matlab |
D |
 |
|
|
|
date |
Current date string |
date() |
|
|
|
|
dec2bin |
The binary representation of a decimal number |
dec2bin |
|
|
|
dec2hex |
Decimal to hexadecimal number conversion |
dec2hex |
|
▹ Empty matrix input: In Matlab dec2hex returns "" when input is [] but Scilab dec2hex returns []. ▹ Complex inputs: In Matlab dec2hex automatically removes complex part of input but not in Scilab. ▹ Two inputs: In Matlab dec2hex can have two inputs, in Scilab mtlb_dec2hex emulates this case. |
|
|
|
delete |
Delete files or graphics objects |
mdelete ↔ delete |
|
▹ Files: When Matlab delete is used to delete a file, Scilab equivalent is mdelete. ▹ Graphics objects: When Matlab delete is used to delete a graphics object, Scilab equivalent is delete. Note that Scilab delete can delete a set of graphics handles is its input is a matrix of such objects. |
|
|
|
diag |
Diagonal including or extracting |
diag |
|
Due to the fact that strings or not considered in the same way in Matlab and in Scilab, results are not equal if A is a string matrix or vector in diag(A) or diag(A,k). Note that mtlb_diag can emulate this particularity in Scilab. |
B = diag('str') B = ['s ';' t ';' r']
|
B = diag(``str'') B = ``str'' B = mtlb_diag(``str'') B = [``s ``;'' t ``;'' r'']
|
|
|
|
diary |
Save session to a file |
diary |
|
When a filename is given to save environment, if this file exists, Scilab returns an error message while Matlab save environment at the end of existing file (append). Note that diary on and diary toggle exist only in Matlab. The equivalent for Matlab diary off is diary(0) in Scilab. |
|
|
|
diff |
Differences and approximate derivatives |
diff |
|
▹ Y = diff(X[,n]): For this kind of use of diff (dim parameter not given), Matlab works on the first non-singleton dimension of X what Scilab does not. In this case, Scilab considers dim to be "*" so that diff threats all values of X, what Matlab does not. ▹ Y = diff(X,n,dim): If dimension given by dim reaches 1 before n iterations have been done, Matlab switches to next non-singleton dimension, but Scilab does not, use mtlb_diff to get equivalent results...When n is greater than all existing dimensions of X, Matlab returns [] what Scilab may not give for all inputs...
|
|
|
|
dir |
Display directory listing |
dir |
|
| When used in command window, Scilab and Matlab dir are equivalents. When result is stored in a value, Matlab returns a struture but Scilab returns a tlist. To get the same result, you can use mtlb_dir, note that in this case, hidden files are not get. |
|
|
|
|
display |
Overloaded method to display an object |
display |
|
|
|
|
disp |
Display text or array |
disp |
|
|
|
docopt |
Web browser for UNIX platforms |
No equivalent |
|
| There no Scilab equivalent function, however, information about Web Browser used can be found using globalvariable %browsehelp. Thos variables exists under all platforms. |
|
|
|
|
doc |
Display online documentation |
help |
|
|
|
dos |
Execute a UNIX command and return result |
unix_g |
|
Output values order is inversed in Scilab and in Matlab. In Scilab use disp to emulate Matlab -echo option. |
[status,result] = dos(...)
|
[result,status] = unix_g(...)
|
|
|
|
double |
Conversion to double precision |
double |
|
| In Matlab, this function returns a Boolean type value for a Boolean input whereas Scilab function returns a Double type value. |
|
|
|
drawnow |
Complete pending drawing events |
No equivalent |
|
In Scilab, drawing events are executed immediately. Scilab drawnow is different from Matlab one. |
|
|
|
|
|
Matlab |
E |
 |
|
|
echo |
Echo lines during execution |
mode |
|
Scilab mode and Matlab echo are not exactly equivalents but they both change the information displayed during execution. Scilab mode has to be called inside a script or a function but Matlab echo can be called from prompt. However, some uses are equivalents such as: ▹ echo: is equivalent to Scilab mode(abs(mode()-1)) for scripts and non-compiled functions ▹ echo on: is equivalent to Scilab mode(1) for scripts and non-compiled functions ▹ echo off: is equivalent to Scilab mode(0) |
|
|
|
eig |
Find eigenvalues and eigenvectors |
spec ↔ bdiag |
|
▹ eig(A): Scilab equivalent for eig(A) is spec(A). Scilab eigen vector matrix can differ from Matlab one... ▹ eig(A,'nobalance'): There is no Scilab equivalent for 'nobalance' option. See examples... ▹ eig(A,B,flag): There is no Scilab equivalent for flag. |
d = eig(A,'balance') [V,D] = eig(A,'balance') d = eig(A,B) [V,D] = eig(A,B)
|
d = spec(A) [V,D] = bdiag(A+%i,1/%eps) [al,be] = spec(A); d = al./be; [al,be,V] = spec(A); D = spec(al./be);
|
|
|
|
|
elseif |
Conditionally execute statements |
elseif |
|
|
|
|
else |
Conditionally execute statements |
else |
|
|
|
|
end |
Terminate loops and conditionals |
end |
|
|
|
|
erfcx |
Scaled complementary error function |
erfcx |
|
|
|
|
erfc |
Complementary error function |
erfc |
|
|
|
error |
Display error messages |
error |
|
| Scilab error function can only take one character string as input but Matlab function can take more than one character string as input and also numerical values... |
|
|
|
etime |
Elapsed time |
etime |
|
| In Scilab, etime can be used with 6 and 10 value vectors but Matlab etime can only be used with 6 value vectors ([Year Month Day Hour Minute Second]). |
|
|
|
eval |
Execute a string containing an instruction/expression |
evstr ↔ execstr |
|
▹ Expression: When eval has to execute an expression then Scilab equivalent for eval is evstr ▹ Instruction: When eval has to execute an instruction with just one output value then Scilab equivalent for eval is evstr. If instruction has more than one output value then execstr has to be used as follows.When eval is used with two inputs then an equivalent can be found in examples below.
|
eval('1+1') eval('x=1+1') eval('[d1,d2]=size(1)') [d1,d2]=eval('size(1)') eval('1+1','1+2')
|
evstr('1+1') x = evstr('1+1') execstr('[d1,d2]=size(1)') execstr('[d1,d2]=size(1)') if execstr("1+1","errcatch") then execstr("1+2");end
|
|
|
|
exist |
Check if a variable or file exists |
exist |
|
Scilab exist function only works for variables, not for M-files or else... Scilab mtlb_exist function is a partial emulation for Matlab exist |
|
|
|
|
exit |
Ends current session |
exit |
|
|
|
|
expm |
Matrix exponential |
expm |
|
|
|
eye |
Identity matrix |
eye |
|
Note that in Matlab, A can contain complex values (in these cases, only real part of A is taken in account), what Scilab function do not tolerate. ▹ B=eye(A): If A is a scalar, then Matlab returns a A*A identity matrix but in Scilab you get a 1, use eye(A,A) to get the same matrix B. If A is a vector, Scilab and Matlab give the same B. Finally, if A is a matrix, in Scilab, B will be a matrix having the same size as A whereas in Matlab, you get an error message. |
B = eye(2) B = [1,0;0,1] B = eye(2,2) B = [1,0;0,1] B = eye([3,3]) B = [1,0,0;0,1,0;0,0,1]
|
B = eye(2) B = 1 B = eye(2,2) B = [1,0;0,1] B = eye([3,3]) B = [1,0]
|
|
|
|
|
|
Matlab |
F |
 |
|
|
|
factor |
Prime numbers decomposition |
factor |
|
|
|
false |
False array |
No equivalent |
|
| To get the same result in Scilab, use: zeros(...)==1. See zeros. |
|
|
|
|
fclose |
Close one or more open files |
mclose |
|
|
|
|
feof |
Test for end-of-file |
meof |
|
|
|
ferror |
Query about errors in file input or output |
mclearerr ↔ merror |
|
▹ ferror(fid): When Matlab ferror is called with just one input and one output, then Scilab equivalent is merror. ▹ ferror(fid,'clear'): When Matlab ferror is called with two inputs and just one output, then Scilab equivalent is mclearerr.For all other cases, there no equivalent in Scilab.
|
|
|
|
feval |
Function evaluation |
evstr ↔ execstr |
|
▹ One output: In this case Scilab evstr is an equivalent to feval, after modifying inputs such as in examples below. ▹ More than one output: In this case Scilab execstr is an equivalent to feval, after modifying inputs such as in examples below. |
[y1] = feval(@cos,0) [y1,y2] = feval(@size,1)
|
y1 = evstr("cos(0)") execstr("[y1,y2] = size(1)")
|
|
|
|
fftshift |
Shift zero-frequency component of discrete Fourier transform to center of spectrum |
fftshift |
|
▹ fftshift(A[,dim]): Due to the fact that strings or not considered in the same way in Matlab and in Scilab, results are not equal if A is a string matrix or vector in fftshift(A) or fftshift(A,dim). mtlb_fftshift can emulate this particularity in Scilab. ▹ fftshift(A,dim): In Matlab, dim can be greater than the number of dimensions of A but in Scilab you get an error message in this case. mtlb_fftshift can emulate this particularity in Scilab. |
Y = fftshift('str') Y = 'rst'
|
Y = fftshift('str') Y = 'str' Y = mtlb_fftshift('str') Y = 'rst'
|
|
|
|
fft(A[,...]) |
Discrete Fourier transform |
fft(A,-1[,...]) |
|
▹ Y = fft(X): If X is a vector then Scilab equivalent for Matlab fft(X) is fft(X,-1). If X is a matrix then Scilab equivalent for Matlab fft(X) is fft(X,-1,2,1). ▹ Y = fft(X,n) / Y = fft(X,n,dim) / Y = fft(X,[],dim): There is no Scilab equivalent for all these Matlab uses of fft, in these cases, use mtlb_fft instead. |
|
|
|
fgetl |
Read line(s) from file, discard newline character |
mgetl |
|
Matlab fgetl reads file line per line while Scilab mgetl allows to read the whole file. Matlab fgetl returns -1 if it could not read a line in file but Scilab mgetl returns an empty string is this case. You can used meof to check if End Of File has been reached. |
|
|
|
fgets |
Read line from file, keep newline character |
fgetstr |
|
| Input parameter order is inversed in Scilab compared to Matlab. |
fgets(fid,n)
|
fgetstr(n,fid)
|
|
|
|
fileparts |
Return filename parts |
fileparts |
|
Scilab function does not get file version but Matlab one does. Scilab function can take a second input parameter specifying the output value we want to get saying: "path", "fname" or "extension". |
|
|
|
filesep |
Return the directory separator for this platform |
No equivalent |
|
| There is no Scilab function equivalent to Matlab filesep but the same output can be obtained with pathconvert("/"). |
|
|
|
findstr |
Find one string within another |
No equivalent |
|
| There is no equivalent for findstr in Scilab, but an emulation function has been written: mtlb_findstr. Scilab strindex function is very similar to findstr but do not consider the size of the strings passed as parameters. strindex can replace findstr only if findstr can be replaced by strfind in Matlab. |
|
|
|
find |
Find indices and values of nonzero elements |
find |
|
Matlab function can work with complex values what is not possible in Scilab, however, using abs it is very easy to have the same results. Note that Scilab function can only return two output values and Matlab one can return a third value that can be computed according to the first two output matrices as explained in Matlab help. For example, in [i,j,v]=find(X), v is equal to: X(i+(j-1))*size(X,1). Another great difference between Scilab and Matlab is that Matlab returns column vectors of indices when X is a column vector or a matrix but Scilab always returns row vectors. For this kind of input, use matrix to get the same output value...what is done mtlb_find() |
|
|
|
|
fix |
Round towards zero |
fix |
|
|
|
fliplr(A) |
Flip matrix in left/right direction |
A(:,$:-1:1) |
|
| Due to the fact that Scilab and Matlab do not consider character string in the same way, result is different for this kind of input, in this case, use mtlb_fliplr instead. |
|
|
|
|
flipud(A) |
Flip matrix in up/down direction |
A($:-1:1,:) |
|
|
|
fopen |
Open a file or obtain information about open files |
mopen |
|
▹ Access permission: Matlab offers two permissions options not supported by Scilab: W and A (for tape drives) ▹ Input values: In Matlab, fopen('all') lists all opened files, in Scilab, this type of call for fopen does not exist. You can also use fopen in Matlab to get informations on a file identifier (fopen(fid)), this case is not implemented in Scilab. ▹ Machine format: Note that Scilab does not support machine format values as input or output.Matlab fopen can return an error message but not Scilab mopen, moreover, returned file identifier is -1 in case of error in Matlab but does not exist in this case in Scilab, so an emulation function has been written mtlb_fopen.
|
|
|
|
format |
Control display format for output |
format |
|
| Some Matlab formats have no Scilab equivalent, see examples below. |
format format + format bank format compact format hex format long format long e format long g format loose format rat format short format short e format short g
|
format("v",6) format(6) No equivalent for: format "bank" No equivalent for: format "compact" No equivalent for: format "hex" format(16) format("e",16) format("e",16) No equivalent for: format "loose" No equivalent for: format "rat" format(6) format("e",6) format("e",6)
|
|
|
|
for |
Repeat statements a specific number of times |
for |
|
| The variable used as loop index is clear in Scilab if all iterations have been made but is not clear if llop is ended by a break. In Matlab, this variable is never cleared. |
|
|
|
fprintf |
Write formatted data to file |
No equivalent |
|
| There is no equivalent function for Matlab fprintf in Scilab but an emulation function has been written: mtlb_fprintf. This function probably not allows all Matlab fprintf possibilities... |
|
|
|
fread |
Read binary data to a file |
No equivalent |
|
| There is no equivalent function for Matlab fread in Scilab but an emulation function has been written: mtlb_fread. This function probably not allows all Matlab fread possibilities (skip parameter is ignored...). |
|