Mercurial > hg > ltpda
diff m-toolbox/html_help/help/ug/plist_create_content.html @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/m-toolbox/html_help/help/ug/plist_create_content.html Wed Nov 23 19:22:13 2011 +0100 @@ -0,0 +1,123 @@ +<p> + Parameters can be grouped together into parameter lists (<tt>plist</tt>). +</p> + +<ul> + <li><a href="plist_create.html#direct">Creating parameter lists directly</a></li> + <li><a href="plist_create.html#append">Appending parameters to a parameter list</a></li> + <li><a href="plist_create.html#find">Finding parameters in a parameter list</a></li> + <li><a href="plist_create.html#remove">Removing parameters from a parameter list</a></li> + <li><a href="plist_create.html#set">Setting parameters in a parameter list</a></li> + <li><a href="plist_create.html#combine">Combining multiple parameter lists</a></li> +</ul> + + +<!-- From parameters --> +<hr> +<h3><a name="params"></a>Creating parameter lists from parameters.</h3> + + +<!-- Direct --> +<hr> +<h3><a name="direct"></a>Creating parameter lists directly.</h3> +<p> +You can also create parameter lists directly using the following constructor format:</p> +<div class="fragment"><pre> + pl = plist(<span class="string">'a'</span>, 1, <span class="string">'b'</span>, <span class="string">'hello'</span>) +</pre></div> +will result in the following output +<div class="fragment"><pre> + ----------- plist 01 ----------- + n params: 2 + ---- param 1 ---- + key: A + val: 1 + ----------------- + ---- param 2 ---- + key: B + val: 'hello' + ----------------- + description: + UUID: 9cc7d1f1-6ca3-477b-a6cc-2629d52579e6 +-------------------------------- +</pre></div> + +<!-- Append --> +<hr> +<h3><a name="append"></a>Appending parameters to a parameter list.</h3> +<p> +Additional parameters can be appended to an existing parameter list using the <tt>append</tt> +method:</p> +<div class="fragment"><pre> + pl = append(pl, <span class="string">'c'</span>, 3) <span class="comment">% append a third parameter</span> +</pre></div> +will result in the following output +<div class="fragment"><pre> + ----------- plist 01 ----------- + n params: 3 + ---- param 1 ---- + key: A + val: 1 + ----------------- + ---- param 2 ---- + key: B + val: 'hello' + ----------------- + ---- param 3 ---- + key: C + val: 3 + ----------------- + -------------------------------- +</pre></div> + + +<!-- Access --> +<hr> +<h3><a name="find"></a>Finding parameters in a parameter list.</h3> +<p> + Accessing the contents of a <tt>plist</tt> can be achieved in two ways: +</p> +<div class="fragment"><pre> + p1 = pl.params(1); <span class="comment">% get the first parameter</span> + val = find(pl, <span class="string">'b'</span>); <span class="comment">% get the second parameter</span> +</pre></div> +<p> + If the parameter name ('key') is known, then you can use the <tt>find</tt> method to + directly retrieve the value of that parameter. +</p> + +<!-- Remove --> +<hr> +<h3><a name="remove"></a>Removing parameters from a parameter list.</h3> +<p> + You can also remove parameters from a parameter list: + <div class="fragment"><pre> + pl = remove(pl, 2) <span class="comment">% Remove the 2nd parameter in the list</span> + pl = remove(pl, <span class="string">'a'</span>) <span class="comment">% Remove the parameter with the key 'a'</span> + </pre></div> +</p> + +<!-- Set --> +<hr> +<h3><a name="set"></a>Setting parameters in a parameter list.</h3> +<p> + You can also set parameters contained in a parameter list: + <div class="fragment"><pre> + pl = plist(<span class="string">'a'</span>, 1, <span class="string">'b'</span>, <span class="string">'hello'</span>) + pl = pset(pl, <span class="string">'a'</span>, 5, <span class="string">'b'</span>, <span class="string">'ola'</span>); <span class="comment">% Change the values of the parameter with the keys 'a' and 'b'</span> + </pre></div> +</p> + + +<!-- Combine --> +<hr> +<h3><a name="combine"></a>Combining multiple parameter lists.</h3> + +<p> + Parameter lists can be combined: + <div class="fragment"><pre> + pl = combine(pl1, pl2) + </pre></div> + If <tt>pl1</tt> and <tt>pl2</tt> contain a parameter with the same key name, the output <tt>plist</tt> contains a parameter with that name but with the value from the first parameter list input. +</p> +