How to deal with the empty matrix?

The empty matrix is ​​an object that should be used sparingly in Scilab. It can be used to initialize a vector or a matrix whose size increases with each step of an algorithm, such as for example

u = [];
for n = 1:4
  u = [u n*ones(1,n)]
end

However, its appearance as a result in a Scilab program is not a very good sign. For example if a vector is indexed by mistake

u = [1 2 3 4]
u(4:1)

the last expression yields the empty matrix

 ans  =
    []

and if the expression u(4:1) is the operand e.g. of an addition, then the result will be an empty matrix again (Scilab gives a warning if such an operation occurs). In fact the rules of operations involving empty matrices are not arbitrary but instead well-defined by using linear algebra and vector spaces, and can even help to simplify the code of some classical algorithms of numerical analysis as it is explained in the following articles:

https://nhigham.com/2016/03/15/empty-matrices-in-matlab/
https://dl.acm.org/doi/10.1145/122272.122273