Creating lists of Parameters


Parameters can be grouped together into parameter lists (plist).


Creating parameter lists from parameters.


Creating parameter lists directly.

You can also create parameter lists directly using the following constructor format:

  pl = plist('a', 1, 'b', 'hello')
will result in the following output
----------- plist 01 -----------
n params: 2
---- param 1 ----
key:   A
val:   1
-----------------
---- param 2 ----
key:   B
val:   'hello'
-----------------
description: 
--------------------------------

Appending parameters to a parameter list.

Additional parameters can be appended to an existing parameter list using the append method:

  pl  = append(pl, 'c', 3)  % append a third parameter
will result in the following output
----------- plist 01 -----------
n params: 3
---- param 1 ----
key:   A
val:   1
-----------------
---- param 2 ----
key:   B
val:   'hello'
-----------------
---- param 3 ----
key:   C
val:   3
-----------------
description: 
--------------------------------

Finding parameters in a parameter list.

Accessing the contents of a plist can be achieved in two ways:

  p1  = pl.params(1);   % get the first parameter
  val = find(pl, 'b');  % get the value for the second parameter

If the parameter name ('key') is known, then you can use the find method to directly retrieve the value of that parameter.


Removing parameters from a parameter list.

You can also remove parameters from a parameter list:

    pl = remove(pl, 2) % Remove the 2nd parameter in the list
    pl = remove(pl, 'a') % Remove the parameter with the key 'a'
  


Setting parameters in a parameter list.

You can also set parameters contained in a parameter list:

    pl1 = plist('a', 1, 'b', 'hello');
    pl2 = pset(pl, 'a', 5, 'b', 'ola')  % Change the values of the parameter with the keys 'a' and 'b'
  


Combining multiple parameter lists.

Parameter lists can be combined:

    pl = combine(pl1, pl2)
  
If pl1 and pl2 contain a parameter with the same key name, the output plist contains a parameter with that name but with the value from the first parameter list input.



©LTP Team