Scilab Home page | Wiki | Bug tracker | Forge | Mailing list archives | ATOMS | File exchange
Please login or create an account
Change language to: Français - Português - 日本語 - Русский

Please note that the recommended version of Scilab is 6.0.1. This page might be outdated.
See the recommended documentation of this function

Scilab Help >> Data Structures > mlist

mlist

Scilab object, matrix oriented typed list definition

Calling Sequence

mlist(typ, a1, ..., an)

Arguments

typ

a vector of character strings.

ai

any Scilab object (matrix, list, string, ...).

Description

mlist object is very similar to tlist object. 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 function.

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

  • tlist — Scilab object and typed list definition.
  • list — a Scilab object and a list definition function
  • overloading — display, functions and operators overloading capabilities
  • getfield — list field extraction
  • setfield — list field insertion
Scilab Enterprises
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Wed Apr 01 10:13:57 CEST 2015