File: mlist.cat

package info (click to toggle)
scilab 2.6-4
  • links: PTS
  • area: non-free
  • in suites: woody
  • size: 54,632 kB
  • ctags: 40,267
  • sloc: ansic: 267,851; fortran: 166,549; sh: 10,005; makefile: 4,119; tcl: 1,070; cpp: 233; csh: 143; asm: 135; perl: 130; java: 39
file content (53 lines) | stat: -rw-r--r-- 1,626 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
mlist            Scilab Group            Scilab Function              mlist
NAME
   mlist - Scilab object, matrix oriented typed list definition.
  
CALLING SEQUENCE
 mlist(typ,a1,....an )  
PARAMETERS
 typ        : vector of character strings
            
 ai         : any Scilab object (matrix, list,string...).
            
DESCRIPTION
   mlist object are very similar to tlist objects. But if M is an mlist, for
  any index i which is not a field name, M(i) is not the ith field of the
  list but is interpreted as the i th entry of M seen as a vector. This is
  the only difference between  mlist and  tlist.
  
    mlist fields must then be designed by their names. They can also be
  handled using the getfield  and setfield  functions. 
  
EXAMPLE
 M=mlist(['V','name','value'],['a','b','c'],[1 2 3]);
 //define display
 deff('%V_p(M)','disp(M.name+'':''+string(M.value))')
 //define extraction operation
 deff('r=%V_e(i,M)',..
 'r=mlist([''V'',''name'',''value''],M.name(i),M.value(i))')
 M(2) // the second entry of the vector M
 M(2).value 
 
 //define M as a tlist
 M=tlist(['V','name','value'],['a','b','c'],[1 2 3]);
 M(2)
 
 M('name')
 
 //with two  indices
 M=mlist(['V','name','value'],['a','b';'c' 'd'],[1 2;3 4]);
 deff('r=%V_e(varargin)',[
     'M=varargin($)';
     'H=[''V'',''name'',''value'']'
     'r=mlist(H,M.name(varargin(1:$-1)),M.value(varargin(1:$-1)))'])
 
 M(:,2)
 // multidimensionnal array
 str=['a','b','c','d','e','f','g','h'];
 n=hypermat([2,2,2],str);
 v=hypermat([2,2,2],1:8);
 M=mlist(['V','name','value'],n,v);
 M(1,1:2,2)
SEE ALSO
   tlist, list, overloading, getfield, setfield