Saturday, July 21, 2012

Function definition in Scilab

So ..., quickly, let's remember what is a function ? A function is a set of commands and operations that are applied to inputs to give us certain outputs. A function is preferred in situations where a block of code is usually used and this -of course- saves programmer's (Scilaber's) time and effort and makes the code compact and small. Another power of functions in Scilab that all the internal variables used in any function are killed (erased) after executing the function.

The following method is used in defining a function



There are many things to note:

Outputs (output variables) should be written in one of the following formats according to the number of outputs


Also, inputs should be written in one of the following formats according to the number of inputs