Please note that the recommended version of Scilab is 2025.0.0. This page might be outdated.
See the recommended documentation of this function
mlist
Scilab object, matrix oriented typed list definition.
Calling Sequence
mlist(typ,a1,....an )
Arguments
- typ
vector of character strings
- ai
any Scilab object (
matrix, list,string...
).
Description
mlist
object are very similar to tlist objects.
The only difference concerns the extraction and insertion syntax:
if M
is an mlist, for any index i
which is
not a field name, M(i)
is no more the i
th
field of the list.
The semantic of the extraction and insertion syntax should be given by an overloading functions.
The overloading function for extraction syntax b=a(i1,...,in)
has the following calling sequence: b=%<type_of_a>_e_(i1,...,in,a)
and the syntax
[x1,..,xm]=a(i1,...,in)
has the following calling sequence:
[x1,..,xm]=%<type_of_a>_e_(i1,...,in,a)
The overloading function associated to the insertion syntax
a(i1,...,in)=b
has the following calling sequence:
a=%<type_of_b>_i_<type_of_a>(i1,...,in,b,a)
.
mlist fields must then be designed by their names. They can also be
handled using the getfield
and setfield
functions.
Examples
M=mlist(['V','name','value'],['a','b';'c' 'd'],[1 2; 3 4]); //define display function %V_p(M),disp(M.name+':'+string(M.value)),endfunction //define extraction operation function r=%V_e(varargin) M=varargin($) r=mlist(['V','name','value'],M.name(varargin(1:$-1)),M.value(varargin(1:$-1))) endfunction M(2,:) // the second row of M M.value //define insertion operations function M=%V_i_V(varargin) M=varargin($) N=varargin($-1) M.value(varargin(1:$-2))=N.value M.name(varargin(1:$-2))=N.name endfunction M(1,1)=M(2,2) function M=%s_i_V(varargin) //insertion of a regular matrix into a V matrix M=varargin($) N=varargin($-1) M.value(varargin(1:$-2))=N M.name(varargin(1:$-2))=emptystr(N) endfunction M(1,1)=44 //tlist case M=tlist(['V','name','value'],['a','b';'c' 'd'],[1 2; 3 4]); M(2) M(2)='a'+string([1 2;3 4]) M('name')
See Also
<< lstcat | Data Structures | rlist >> |