Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
6.1.0 - English

Change language to:
Français - 日本語 - Português - Русский

Please note that the recommended version of Scilab is 2025.0.0. This page might be outdated.
See the recommended documentation of this function

Scilab Help >> Scilab > types > boolean

boolean

Scilab Objects, boolean variables and operators & | ~

Description

A boolean variable is %T (for "true") or %F (for "false"). These variables can be used to define matrices of booleans, with the usual syntax. Boolean matrices can be manipulated as ordinary matrices for elements extraction/insertion and concatenation.

Note that other usual operations (+, *, -, ^, etc) are undefined for boolean matrices. Three special operators are defined for boolean matrices:

~b

is the element-wise negation of boolean b (matrix).

b1 & b2

is the element-wise logical and of b1 and b2 (matrices).

b1 | b2

is the element-wise logical or of b1 and b2 (matrices).

Boolean variables can be used for indexing matrices or vectors. For instance a([%T,%F,%T],:) returns the submatrix made of rows 1 and 3 of a. Boolean sparse matrices are supported.

Examples

[1,2]==[1,3]
[1,2]==1
a=1:5; a(a>2)

See also

  • matrices — Scilab objects, matrices in Scilab
  • or — logical OR over the elements of a boolean or numerical array
  • and — logical AND between the elements of a boolean or numerical array
  • not — (~) logical not
Report an issue
<< types types hypermatrices >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Tue Feb 25 08:49:18 CET 2020