1
insertion Scilab Group Scilab Function insertion
3
insertion - matrix and list insertion or modification
9
l(k1)...(kn)(i)=a or l(list(k1,...,kn,i))=a
10
l(k1)...(kn)(i,j)=a or l(list(k1,...,kn,list(i,j))=a
12
x : matrix of any kind (constant, sparse, polynomial,...)
18
k1,...kn : indices with integer value
26
- real scalars or vectors or matrices with positive elements.
28
* if a is a matrix with dimensions (size(i,'*'),size(j,'*'))
29
x(i,j)=a returns a new x matrix such as
30
x(int(i(l)),int(j(k)))=a(l,k) for l from 1 to size(i,'*')
31
and k from 1 to size(j,'*'), other initial entries of x are
34
if a is a scalar x(i,j)=a returns a new x matrix such as
35
x(int(i(l)),int(j(k)))=a for l from 1 to size(i,'*') and k
36
from 1 to size(j,'*'), other initial entries of x are
37
unchanged. If i or j maximum value exceed corresponding x
38
matrix dimension x is previously extended to the required
39
dimensions with zeros entries for standard matrices, 0 length
40
character string for string matrices and false values for
43
* x(i,j)=[] kills rows specified by i if j matches all columns
44
of x or kills columns specified by j if i matches all rows of
45
x. In other cases x(i,j)=[] produce an error.
47
* x(i)=a with a a vector returns a new x matrix such as
48
x(int(i(l)))=a(l) for l from 1 to size(i,'*') , other initial
49
entries of x are unchanged.
51
x(i)=a with a a scalar returns a new x matrix such as
52
x(int(i(l)))=a for l from 1 to size(i,'*') , other initial
53
entries of x are unchanged.
55
If i maximum value exceed size(x,1), x is previously extended
56
to the required dimension with zeros entries for standard
57
matrices, 0 length character string for string matrices and
58
false values for boolean matrices.
60
if x is a 1x1 matrix a may be a row (respectively a column)
61
vector with dimension size(i,'*'). Resulting x matrix is a
62
row (respectively a column) vector
64
if x is a row vector a must be a row vector with dimension
67
if x is a column vector a must be a column vector with
70
if x is a general matrix a must be a row or column vector
71
with dimension size(i,'*') and i maximum value cannot
74
* x(i)=[] kills entries specified by i.
76
- the : symbol which stands for "all elements".
78
* x(i,:)=a is interpreted as x(i,1:size(x,2))=a
80
* x(:,j)=a is interpreted as x(1:size(x,1),j)=a
82
* x(:)=a returns in x the a matrix reshaped according to x
83
dimensions. size(x,'*') must be equal to size(a,'*')
87
- vector of boolean. If an index (i or j )is a vector of booleans
88
it is interpreted as find(i) or respectively find(j)
90
- a polynomial. If an index (i or j )is a vector of polynomials
91
or implicit polynomial vector it is interpreted as horner(i,m) or
92
respectively horner(j,n) where m and n are associated x
93
dimensions. Even if this feature works for all polynomials, it
94
is recommended to use polynomials in $ for readability.
97
If they are present the ki give the path to a sub-list entry of l data
98
structure. They allow a recursive extraction without intermediate
99
copies. The l(k1)...(kn)(i)=a and l(list(k1,...,kn,i)=a)
100
instructions are interpreted as: lk1 = l(k1) .. = .. lkn
101
= lkn-1(kn) lkn(i) = a lkn-1(kn) = lkn .. = .. l(k1) =
102
lk1 And the l(k1)...(kn)(i,j)=a and l(list(k1,...,kn,list(i,j))=a
103
instructions are interpreted as: lk1 = l(k1) .. = ..
104
lkn = lkn-1(kn) lkn(i,j) = a lkn-1(kn) = lkn .. = ..
107
- a real non negative scalar. l(0)=a adds an entry on the
108
"left" of the list l(i)=a sets the i entry of the list l to
109
a. if i>size(l), l is previously extended with zero length
110
entries (undefined). l(i)=null() suppress the ith list
113
- a polynomial. If i is a polynomial it is interpreted as
114
horner(i,m) where m=size(l). Even if this feature works for
115
all polynomials, it is recommended to use polynomials in $
120
- real positive scalar.
122
- a polynomial,interpreted as horner(ki,m) where m is the
123
corresponding sub-list size.
126
- a character string associated with a sub-list entry name.
127
For soft coded matrix types such as rational functions and state space
128
linear systems, x(i) syntax may not be used for vector entry insertion
129
due to confusion with list entry insertion. x(1,j) or x(i,1) syntax must
138
a(1,3:-1:1)=[77 44 99]
150
b=[1/%s,(%s+1)/(%s-1)]
153
b(2)=[1 2] // the numerator
154
// LIST OR TLIST CASE
158
l(6)=['one more';'added']
161
dts=list(1,tlist(['x';'a';'b'],10,[2 3]));
163
dts(2)('b')(1,2)=-100
165
find, horner, parents, extraction