Values in Scilab

Scilab has various value types including strings, integers, floats, booleans, etc. Here are a few basic examples.

// Strings, which can be added together with +
disp("sci" + "lab")

// Integers and floats
disp("1+1 =")
disp(1 + 1)
disp("7.0/3.0 =")
disp(7.0 / 3.0)

// Booleans, with boolean operators as you'd expect
disp(%t & %f)
disp(%t | %f)
disp(~%t)

To run this Scilab script, save it to a file (e.g., values.sce) and execute it in Scilab:

--> exec('values.sce', -1)
scilab
1+1 =
   2.
7.0/3.0 =
   2.3333333
  F
  T
  F

In Scilab:

  • Strings are enclosed in double quotes and can be concatenated using the + operator.
  • Numeric operations work similarly to other programming languages.
  • Boolean values are represented by %t (true) and %f (false).
  • Boolean operators are & (and), | (or), and ~ (not).
  • The disp() function is used to print values to the console.

Note that Scilab uses 1-based indexing and has a focus on matrix operations, which makes it particularly suited for numerical computations and scientific applications.