Please note that the recommended version of Scilab is 2025.0.0. This page might be outdated.
See the recommended documentation of this function
list
a Scilab object and a list definition function
Calling Sequence
list(a1, ..., an)
Description
Creates a list
with elements
ai
's which are arbitrary Scilab objects
(matrix
,
list
,...). Type of
list
objects is 15. list()
creates the empty list
(0 element).
Operations on lists
- extraction
[x,y,z,...]=L(v)
wherev
is a vector of indices;[x,y,z,...]=L(:)
extracts all the elements.- insertion at index i
L(i)=a
(note that it is not an error to useL(i)=a
withi > 1 + size(L)
but some list entries are then undefined and their extraction gives raise to an error).- append an element in queue
L($+1)=e
.- append an element in head
L(0)=e
.After this operatione
is an index 1, the initial elements being shifted on the right.- deletion
L(i)=null()
removes thei
-th element of the listL
.- concatenation of two lists
L3 = lstcat(L1,L2)
.- number of elements of a list
- iterations with a list
it is possible to use a list
L
with a for loop:for e=L,...,end
is a loop withlength(L)
iterations, the loop variablee
being equal toL(i)
at thei
-th iteration.
Remarks
Scilab provides also other kinds of list, the tlist type (typed list) and the mlist type which are useful to define a new data type with operator overloading facilities (hypermatrices which are multidimensional arrays in Scilab are in fact mlist).
Matlab struct are also available.
Examples
See Also
- null — delete an element in a list
- lstcat — list concatenation
- tlist — Scilab object and typed list definition.
- mlist — Scilab object, matrix oriented typed list definition
- insertion — partial variable assignation or modification
- extraction — matrix and list entry extraction
- size — size of objects
- length — length of object
Report an issue | ||
<< isstruct | Data Structures | lsslist >> |