Scilab 6.0.0

Please note that the recommended version of Scilab is 6.0.2. This page might be outdated.

See the recommended documentation of this function

# ones (Matlab function)

Create an array of all ones

### Particular cases

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. |

// Scilab version B=ones(A)

Most differences stem from the use of *ones* in conjunction with
*size*. In Scilab you do not need to use size:

// Scilab version A = [1 2; 3 4]; B = ones(A) B =[ 1 1; 1 1]

As a result, if A is a scalar, then Matlab will return a *A*A* matrix of ones but in Scilab you get a
*1* (just because a scalar is a *1*1* matrix), so use
*ones(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.

## Comments

Add a comment:Please login to comment this page.