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 > tlist

tlist

Scilab object and typed list definition.

Calling Sequence

tlist(typ,a1,....an )

Arguments

typ

Character string or vector of character strings

ai

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

Description

Creates a typed-list with elements ai's. The typ argument specifies the list type. Such typed-list allow the user to define new operations working on these object through scilab functions. The only difference between typed-list and list is the value of the type (16 instead of 15).

typ(1) specifies the list type (character string used to define soft coded operations)

if specified typ(i) may give the i+1th element formal name

Standard Operations on list work similarly for typed-list:

extraction : [x,y,z...]=l(v) where v is a vector of indices; [x,y,z]=l(:) extracts all the elements.

insertion : l(i)=a

deletion : l(i)=null() removes the i-th element of the tlist l. Note that the semantics of l.x=null() is undefined, but a definition can be given through the overloading mechanism.

display

Moreover if typ(2:n+1) are specified, user may point elements by their names

We give below examples where tlist are used.

Linear systems are represented by specific typed-list e.g. a linear system [A,B,C,D] is represented by the tlist Sys=tlist(['lss';'A';'B';'C';'D';'X0';'dt'],A,B,C,D,x0,'c') and this specific list may be created by the function syslin.

Sys(2), Sys('A') or Sys.A is the state-matrix and Sys('dt') or Sys.dt is the time domain

A rational matrix H is represented by the typed-list H=tlist(['r';'num';'den';'dt'],Num,Den,[]) where Num and Den are two polynomial matrices and a (e.g. continuous time) linear system with transfer matrix H maybe created by syslin('c',H).

H(2), H('num') or H.num is the transfer matrix numerator

Examples

// tlist creation
t = tlist(["listtype","field1","field2"], [], []);
t.field1(1) = 10;
t.field1(2) = 20;
t.field2(1) = "Scilab";
t.field2(2) = "tlist";
t.field2(3) = "example";

// Fields contents display
disp(t.field1)
disp(t.field2)

// Generic tlist display
disp(t)

// Overloading display for this type of tlist
function %listtype_p(mytlist)
  f = fieldnames(mytlist);

  // typeof(mytlist) <=> f(1)
  mprintf("Displaying a tlist of type: %s\n", typeof(mytlist));

  mprintf("\n");

  mprintf("-- Field ''%s'' --\n", f(1));
  mprintf("Contents: %s\n", sci2exp(mytlist(f(1))));

  mprintf("\n");

  mprintf("-- Field ''%s'' --\n", f(2));
  mprintf("Contents: %s\n", sci2exp(mytlist(f(2))));
endfunction

// Display using overloading function
disp(t)

See Also

  • percent — (%) special character
  • syslin — linear system definition
  • list — Scilab object and list function definition
Scilab Enterprises
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Thu May 12 11:44:27 CEST 2011