- Scilab Online Help
- Scilab
- Scilab keywords
- TMPDIR
- abort
- add_demo
- argn
- banner
- boolean
- break
- clear
- clearfun
- clearglobal
- comp
- continue
- debug
- delbpt
- dispbpt
- edit
- errcatch
- errclear
- error
- error_table
- exists
- exit
- external
- extraction
- format
- funcprot
- funptr
- getdebuginfo
- getmd5
- getmemory
- getmodules
- getos
- getscilabmode
- getshell
- getvariablesonstack
- getversion
- gstacksize
- ieee
- insertion
- intppty
- inv_coeff
- iserror
- isglobal
- lasterror
- macr2lst
- macr2tree
- matrices
- matrix
- mode
- mtlb_mode
- names
- newfun
- null
- pause
- perl
- poly
- predef
- quit
- rational
- readgateway
- resume
- sciargs
- scilab
- setbpt
- stacksize
- startup
- symbols
- testmatrix
- type
- typename
- user
- varn
- ver
- warning
- what
- where
- whereami
- who
- who_user
- whos
- with_atlas
- with_javasci
- with_macros_source
- with_module
- with_pvm
- with_texmacs
- with_tk
Please note that the recommended version of Scilab is 2025.0.0. This page might be outdated.
See the recommended documentation of this function
insertion
partial variable assignation or modification
assignation
partial variable assignation
Calling Sequence
x(i,j)=a x(i)=a l(i)=a l(k1)...(kn)(i)=a or l(list(k1,...,kn,i))=a l(k1)...(kn)(i,j)=a or l(list(k1,...,kn,list(i,j))=a
Arguments
- x
matrix of any kind (constant, sparse, polynomial,...)
- l
list
- i,j
indices
- k1,...kn
indices with integer value
- a
new entry value
Description
- MATRIX CASE
if
x
is a matrix the indicesi
andj
, may be:- Real scalars or vectors or matrices
In this case the values given as indices should be positive and it is only their integer part which taken into account.
if
a
is a matrix with dimensions(size(i,'*'),size(j,'*'))
,x(i,j)=a
returns a newx
matrix such asx(int(i(l)),int(j(k)))=a(l,k)
forl
from 1 tosize(i,'*')
andk
from 1 tosize(j,'*')
, other initial entries ofx
are unchanged.if
a
is a scalarx(i,j)=a
returns a newx
matrix such asx(int(i(l)),int(j(k)))=a
forl
from 1 tosize(i,'*')
andk
from 1 tosize(j,'*')
, other initial entries ofx
are unchanged.If
i
orj
maximum value exceed correspondingx
matrix dimension, arrayx
is previously extended to the required dimensions with zeros entries for standard matrices, 0 length character string for string matrices and false values for boolean matrices.x(i,j)=[]
kills rows specified byi
ifj
matches all columns ofx
or kills columns specified byj
ifi
matches all rows ofx
. In other casesx(i,j)=[]
produce an error.x(i)=a
witha
a vector returns a newx
matrix such asx(int(i(l)))=a(l)
forl
from 1 tosize(i,'*')
, other initial entries ofx
are unchanged.x(i)=a
witha
a scalar returns a newx
matrix such asx(int(i(l)))=a
forl
from 1 tosize(i,'*')
, other initial entries ofx
are unchanged.If
i
maximum value exceedsize(x,1)
,x
is previously extended to the required dimension with zeros entries for standard matrices, 0 length character string for string matrices and false values for boolean matrices.- if
x
is a 1x1matrix
a
may be a row (respectively a column) vector with dimensionsize(i,'*')
. Resultingx
matrix is a row (respectively a column) vector- if
x
is a rowvector
a
must be a row vector with dimensionsize(i,'*')
- if
x
is a columnvector
a
must be a column vector with dimensionsize(i,'*')
- if
x
is a generalmatrix
a
must be a row or column vector with dimensionsize(i,'*')
andi
maximum value cannot exceedsize(x,'*')
,
x(i)=[]
kills entries specified byi
.
- The : symbol
the
:
symbol stands for "all elements".x(i,:)=a
is interpreted asx(i,1:size(x,2))=a
x(:,j)=a
is interpreted asx(1:size(x,1),j)=a
x(:)=a
returns inx
thea
matrix reshaped according to x dimensions.size(x,'*')
must be equal tosize(a,'*')
- Vectors of boolean
If an index (
i
orj
)is a vector of booleans it is interpreted asfind(i)
or respectivelyfind(j)
- Polynomials
If an index (
i
orj
)is a vector of polynomials or implicit polynomial vector it is interpreted ashorner(i,m)
or respectivelyhorner(j,n)
wherem
andn
are associatedx
dimensions. Even if this feature works for all polynomials, it is recommended to use polynomials in$
for readability.
- LIST OR TLIST CASE
If they are present the
ki
give the path to a sub-list entry ofl
data structure. They allow a recursive insertion without intermediate copies. Thel(k1)...(kn)(i)=a
andl(list(k1,...,kn,i)=a)
instructions are interpreted as:lk1 = l(k1)
.. = ..
lkn = lkn-1(kn)
lkn(i) = a
lkn-1(kn) = lkn
.. = ..
l(k1) = lk1
And the
l(k1)...(kn)(i,j)=a
andl(list(k1,...,kn,list(i,j))=a
instructions are interpreted as:lk1 = l(k1)
.. = ..
lkn = lkn-1(kn)
lkn(i,j) = a
lkn-1(kn) = lkn
.. = ..
l(k1)= lk1
i
may be :a real non negative scalar.
l(0)=a
adds an entry on the "left" of the listl(i)=a
sets thei
entry of the listl
toa
. ifi>size(l)
,l
is previously extended with zero length entries (undefined).l(i)=null()
suppress thei
th list entry.a polynomial. If
i
is a polynomial it is interpreted ashorner(i,m)
wherem=size(l)
. Even if this feature works for all polynomials, it is recommended to use polynomials in$
for readability.
k1,..kn
may be :real positive scalar.
a polynomial,interpreted as
horner(ki,m)
wherem
is the corresponding sub-list size.a character string associated with a sub-list entry name.
Remarks
For soft coded matrix types such as rational functions and state space linear systems, x(i)
syntax may not be used for vector entry insertion due to confusion with list entry insertion. x(1,j)
or x(i,1)
syntax must be used.
Examples
// MATRIX CASE a=[1 2 3;4 5 6] a(1,2)=10 a([1 1],2)=[-1;-2] a(:,1)=[8;5] a(1,3:-1:1)=[77 44 99] a(1)=%s a(6)=%s+1 a(:)=1:6 a([%t %f],1)=33 a(1:2,$-1)=[2;4] a($:-1:1,1)=[8;7] a($)=123 // x='test' x([4 5])=['4','5'] // b=[1/%s,(%s+1)/(%s-1)] b(1,1)=0 b(1,$)=b(1,$)+1 b(2)=[1 2] // the numerator // LIST OR TLIST CASE l=list(1,'qwerw',%s) l(1)='Changed' l(0)='Added' l(6)=['one more';'added'] // // dts=list(1,tlist(['x';'a';'b'],10,[2 3])); dts(2).a=33 dts(2)('b')(1,2)=-100
See Also
<< ieee | Scilab | intppty >> |