Scilab Home page | Wiki | Bug tracker | Forge | Mailing list archives | ATOMS | File exchange
Please login or create an account
Change language to: English - Français - Português - 日本語 -
Справка Scilab >> Scilab > types > typeof


explicit type or overloading code of an object


t  = typeof(object)
oc = typeof(object, "overload")



a Scilab object


a string (may have spaces): the name of the type of object


a string (without spaces): the name of the overloading code for the object.


t = typeof(object) returns one of the following strings:

string object is a matrix or hypermatrix made of characters and texts.
boolean object is a boolean matrix or hypermatrix.
int8 or int16 or int32 or int64 or uint8 or uint16 or uint32 or uint64
object is a matrix or hypermatrix of [unsigned] integers stored on 8, 16, 32 or 64 bits. (see inttype)
constant object is matrix or hypermatrix of decimal or complex numbers.
polynomial object is a matrix or hypermatrix of with decimal or complex coefficients.
rational object is a matrix or hypermatrix of rational fractions (e.g. transfer matrix), with decimal or complex coefficients.
handle object is a graphics handle. The subtype of graphics handles (Figure, Axes, Polyline, Compound, etc) is available in their .type property. See examples below.
list object is a list.
st object is a structure or a nD-array of structures.
ce object is a cell or a nD-array of cells.
boolean sparse object is a .
Sparse boolean hypermatrices are not supported.
sparse object is a of decimal or complex numbers.
Sparse numerical hypermatrices are not supported.
fptr object is a built-in Scilab function, called also gateway (C, C++ or Fortran code), a.k.a. a primitive.
function object is a function (Scilab code). See also deff.
library object is a library of functions in Scilab language.
pointer object is a pointer. See a use case: .
implicitlist object is an implicit list using a polynomial as formal index, for indexing. See n:$ : (colon)
listdelete is returned by typeof(null()) . See null().
void is the typeof undefined elements in lists.
Typed T-Lists or M-Lists:
Note that if the object is a tlist or a mlist, typeof will return the corresponding customized type stored in as a string in the first list entry.
Reserved T-List or M-List types predefined in Scilab:
dir object is the result of a dir() instruction, with fields name, date, bytes, and isdir.
state-space object is a state-space model (see ).
program object is a list describing the internal code of a function (see macr2tree).
cblock object is a block of columns of same heights but of different data types, as returned by mfscanf.
XMLDoc object is an XML Document created with , , , or . Additional XML typeof are defined.
H5Object object is the id of an HDF5 file opened with h5open. Additional HDF5 typeof are defined: See HDF5 Objects.
uitree object is a tree, a branch or a leaf as created with a uitree feature. See for instance uiCreateNode.
Reserved T-list types used in Xcos :
object is a Xcos block.
object is a tlist containing the compilation results of a Xcos diagram.
object is a tlist defining a Xcos diagram: initial parameters, set of blocks, of links between blocks, and of Text labels belonging to the diagram.
object is a tlist assigned to the .graphics field of a block.
object is a tlist defining and configuring a link between 2 blocks.
object is a tlist assigned to the .model field of a block.
object is a tlist containing some configuration parameters of a Xcos diagram.
scsopt object is a tlist containing the graphical options of the Xcos diagram editor.
object is a tlist containing static results of the compilation of a Xcos diagram.
object is a tlist containing dynamical results during a Xcos simulation.
Text object is a tlist defining a text label in a Xcos diagram.


// Characters and texts
t = ["a" "Hello"   "à é è ï ô û ñ"
     "1" "Bonjour" "указывает тип объекта"
     ";" "Chao"    "オブジェクトの型"

// Booleans
hm = grand(2,2,2,"uin",0,9)<5

// Encoded integers
[ typeof(uint8(%pi))  typeof(int8(-%pi))
  typeof(uint16(%pi)) typeof(int16(-%pi))
  typeof(uint32(%pi)) typeof(int32(-%pi))
  typeof(uint64(%pi)) typeof(int64(-%pi))

// Decimal numbers
n = 1:0.3:2
hm = grand(2,2,2,"uin",0,9)

// Decimal integers
n = 1:7

// Complex numbers
n = [%i 1-%i %pi - 3*%i]

// Special "constant"
typeof([])   // empty matrix

// Polynomials
n = [ %z (1-%z)^2]
n = [ 3*%i + %z (1-%i*%z)^2]

// Rational fractions
r = [%s/(1-%s) (1+%s)^2/(1-%s)]   // with real coefficients
r = [%s/(%i-%s) (%i+%s)^2/(1-%s)] // with complex coefficients

// Sparse matrices
// ---------------
w = sprand(100,100,0.001)
typeof(w)     // sparse
typeof(w==w)  // boolean sparse

// Functions and libraries
// -----------------------
deff('y=f(x)','y=2*x');  // Function in Scilab language
typeof(cosd)  // written in Scilab

typeof(corelib) // Library of functions in Scilab language

typeof(sin)     // Built-in function (non-editable)
mysin = sin;

// Graphical handles
// -----------------
// The subtype of the handle is in the "type" property:


// Containers
// ----------
// Simple list
L = list(%pi, %t, %z, %s/(1-%s), "Bonjour", sin, cosd, list("list_in_list", 432));

// Cells array
C = {%pi, %t, %z ; %s/(1-%s), "Bonjour", list("list_in_list", 432) }

// (Array of) Structure
S.num = %pi;
S.b = %t;
S(2).t = "Bonjour"

// Special generic indexing expressions
// ------------------------------------
typeof(:)    // "eye()" equivalent (all elements)

// Typeof for deletion or undefined elements:
// -----------------------------------------
typeof([])      // empty matrix
L = list(%pi, ,"hey!")
typeof(L(2))   // undefined element

// Customized typeof of T-Lists:
// ----------------------------
L = tlist(['myLongTypeOf','a','b'], 18, 'Scilab');

// Reserved T-List typeof
// ----------------------
typeof(dir())        // Files directory
c = macr2tree(sind); // Internal code of a Scilab macro
doc = xmlReadStr("<root><a att=""foo"">Hello</a></root>");
x = 1;
save(TMPDIR + "/x.sod", "x"); // SOD files are HDF5 ones
a = h5open(TMPDIR + "/x.sod");

See also

  • type — возвращает тип переменной
  • inttype — возвращает тип целых чисел, используемых в типах целочисленных данных
  • overloading — возможности перегрузки отображения, функций и операторов
  • isreal — проверка, имеет ли переменная вещественные или комплексные элементы
  • strings — объект Scilab'а, символьные строки
  • rlist — определение функции рационального деления Scilab
  • null — deletes a list component or a field of a structure, Mlist, or Tlist
  • dir — получает список файлов
  • HDF5 Objects — Describe the properties of the different H5 objects


  • "overload" keyword added.
  • typeof "uint64" and "int64" added.
  • typeof "hypermat" removed. Hypermatrices of any homogeneous type are now natively supported.
  • typeof "listdelete" added (as returned by null()).
  • typeof() can now be used for any undefined element of a list. It then returns the new "void" typeof.
  • The typeof of T-lists and M-lists were limited to 8 characters. They may be longer now.
  • typeof "size implicit" renamed "implicitlist" (1:$)
  • Help page reviewed.
Scilab Enterprises
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Tue Jul 20 11:21:15 CEST 2021