Creating lists of Parameters


Parameters can be grouped together into parameter lists (plist). The following code shows how to create a parameter list from individual parameters.

	>> p1 = param('a', 1);  % create first parameter
	>> p1 = param('b', 2);  % create second parameter
	>> pl = plist([p1 p2])  % create parameter list
	n params: 2
	---- param 1 ----
	key: a
	val: 1
	-----------------
	---- param 2 ----
	key: b
	val: 2
	-----------------  
  

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 second parameter
  

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

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

	>> pl  = append(pl, param('c', 3))  % append a third parameter
	n params: 3
	---- param 1 ----
	key: a
	val: 1
	-----------------
	---- param 2 ----
	key: b
	val: 2
	-----------------
	---- param 3 ----
	key: c
	val: 3
	-----------------
	




©LTP Team