- Compatibility Functions
Please note that the recommended version of Scilab is 2023.1.0. This page might be outdated.
See the recommended documentation of this function
Matlab size emulation function
Matlab and Scilab
size behave differently in some particular cases:
With two inputs: Matlab
sizecan be used with second parameter giving a not-existing dimension of first parameter (returns 1 in this case) but not Scilab one.
With more than one output: if number of output is lesser than number of dimensions, last output is the product of all remaining dimensions in Matlab but not in Scilab. If number of output is greater than number of dimensions, outputs corresponding to a not-existing dimension are set to 1 in Matlab but Scilab gives an error in this case.
[d1,[d2,...]] = mtlb_size(X[,dim]) is used by
mfile2sci to replace
[d1,[d2,...]] = size(X[,dim]) when it was not
possible to know what were the inputs while porting Matlab code to Scilab. This function will
determine the correct semantic at run time. If you want to have a
more efficient code it is possible to replace
With two inputs: if
dimgives an existing dimension of
mtlb_size(X,dim)may be replaced by
With more than one outputs: if the number of outputs is equal to the number of dimensions of
[d1,[d2,...]] = mtlb_size(X)may be replaced by
[d1,[d2,...]] = size(X)
|Report an issue|
|<< mtlb_setstr||Compatibility Functions||mtlb_sort >>|