Mercurial > hg > ltpda
comparison m-toolbox/html_help/help/ug/plist_create.html @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:f0afece42f48 |
---|---|
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" | |
2 "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd"> | |
3 | |
4 <html lang="en"> | |
5 <head> | |
6 <meta name="generator" content= | |
7 "HTML Tidy for Mac OS X (vers 1st December 2004), see www.w3.org"> | |
8 <meta http-equiv="Content-Type" content= | |
9 "text/html; charset=us-ascii"> | |
10 | |
11 <title>Creating lists of Parameters (LTPDA Toolbox)</title> | |
12 <link rel="stylesheet" href="docstyle.css" type="text/css"> | |
13 <meta name="generator" content="DocBook XSL Stylesheets V1.52.2"> | |
14 <meta name="description" content= | |
15 "Presents an overview of the features, system requirements, and starting the toolbox."> | |
16 </head> | |
17 | |
18 <body> | |
19 <a name="top_of_page" id="top_of_page"></a> | |
20 | |
21 <p style="font-size:1px;"> </p> | |
22 | |
23 <table class="nav" summary="Navigation aid" border="0" width= | |
24 "100%" cellpadding="0" cellspacing="0"> | |
25 <tr> | |
26 <td valign="baseline"><b>LTPDA Toolbox</b></td><td><a href="../helptoc.html">contents</a></td> | |
27 | |
28 <td valign="baseline" align="right"><a href= | |
29 "plist_intro.html"><img src="b_prev.gif" border="0" align= | |
30 "bottom" alt="Parameter Lists"></a> <a href= | |
31 "sim_model.html"><img src="b_next.gif" border="0" align= | |
32 "bottom" alt="Simulation/modelling"></a></td> | |
33 </tr> | |
34 </table> | |
35 | |
36 <h1 class="title"><a name="f3-12899" id="f3-12899"></a>Creating lists of Parameters</h1> | |
37 <hr> | |
38 | |
39 <p> | |
40 <p> | |
41 Parameters can be grouped together into parameter lists (<tt>plist</tt>). | |
42 </p> | |
43 | |
44 <ul> | |
45 <li><a href="plist_create.html#direct">Creating parameter lists directly</a></li> | |
46 <li><a href="plist_create.html#append">Appending parameters to a parameter list</a></li> | |
47 <li><a href="plist_create.html#find">Finding parameters in a parameter list</a></li> | |
48 <li><a href="plist_create.html#remove">Removing parameters from a parameter list</a></li> | |
49 <li><a href="plist_create.html#set">Setting parameters in a parameter list</a></li> | |
50 <li><a href="plist_create.html#combine">Combining multiple parameter lists</a></li> | |
51 </ul> | |
52 | |
53 | |
54 <!-- From parameters --> | |
55 <hr> | |
56 <h3><a name="params"></a>Creating parameter lists from parameters.</h3> | |
57 | |
58 | |
59 <!-- Direct --> | |
60 <hr> | |
61 <h3><a name="direct"></a>Creating parameter lists directly.</h3> | |
62 <p> | |
63 You can also create parameter lists directly using the following constructor format:</p> | |
64 <div class="fragment"><pre> | |
65 pl = plist(<span class="string">'a'</span>, 1, <span class="string">'b'</span>, <span class="string">'hello'</span>) | |
66 </pre></div> | |
67 will result in the following output | |
68 <div class="fragment"><pre> | |
69 ----------- plist 01 ----------- | |
70 n params: 2 | |
71 ---- param 1 ---- | |
72 key: A | |
73 val: 1 | |
74 ----------------- | |
75 ---- param 2 ---- | |
76 key: B | |
77 val: 'hello' | |
78 ----------------- | |
79 description: | |
80 UUID: 9cc7d1f1-6ca3-477b-a6cc-2629d52579e6 | |
81 -------------------------------- | |
82 </pre></div> | |
83 | |
84 <!-- Append --> | |
85 <hr> | |
86 <h3><a name="append"></a>Appending parameters to a parameter list.</h3> | |
87 <p> | |
88 Additional parameters can be appended to an existing parameter list using the <tt>append</tt> | |
89 method:</p> | |
90 <div class="fragment"><pre> | |
91 pl = append(pl, <span class="string">'c'</span>, 3) <span class="comment">% append a third parameter</span> | |
92 </pre></div> | |
93 will result in the following output | |
94 <div class="fragment"><pre> | |
95 ----------- plist 01 ----------- | |
96 n params: 3 | |
97 ---- param 1 ---- | |
98 key: A | |
99 val: 1 | |
100 ----------------- | |
101 ---- param 2 ---- | |
102 key: B | |
103 val: 'hello' | |
104 ----------------- | |
105 ---- param 3 ---- | |
106 key: C | |
107 val: 3 | |
108 ----------------- | |
109 -------------------------------- | |
110 </pre></div> | |
111 | |
112 | |
113 <!-- Access --> | |
114 <hr> | |
115 <h3><a name="find"></a>Finding parameters in a parameter list.</h3> | |
116 <p> | |
117 Accessing the contents of a <tt>plist</tt> can be achieved in two ways: | |
118 </p> | |
119 <div class="fragment"><pre> | |
120 p1 = pl.params(1); <span class="comment">% get the first parameter</span> | |
121 val = find(pl, <span class="string">'b'</span>); <span class="comment">% get the second parameter</span> | |
122 </pre></div> | |
123 <p> | |
124 If the parameter name ('key') is known, then you can use the <tt>find</tt> method to | |
125 directly retrieve the value of that parameter. | |
126 </p> | |
127 | |
128 <!-- Remove --> | |
129 <hr> | |
130 <h3><a name="remove"></a>Removing parameters from a parameter list.</h3> | |
131 <p> | |
132 You can also remove parameters from a parameter list: | |
133 <div class="fragment"><pre> | |
134 pl = remove(pl, 2) <span class="comment">% Remove the 2nd parameter in the list</span> | |
135 pl = remove(pl, <span class="string">'a'</span>) <span class="comment">% Remove the parameter with the key 'a'</span> | |
136 </pre></div> | |
137 </p> | |
138 | |
139 <!-- Set --> | |
140 <hr> | |
141 <h3><a name="set"></a>Setting parameters in a parameter list.</h3> | |
142 <p> | |
143 You can also set parameters contained in a parameter list: | |
144 <div class="fragment"><pre> | |
145 pl = plist(<span class="string">'a'</span>, 1, <span class="string">'b'</span>, <span class="string">'hello'</span>) | |
146 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> | |
147 </pre></div> | |
148 </p> | |
149 | |
150 | |
151 <!-- Combine --> | |
152 <hr> | |
153 <h3><a name="combine"></a>Combining multiple parameter lists.</h3> | |
154 | |
155 <p> | |
156 Parameter lists can be combined: | |
157 <div class="fragment"><pre> | |
158 pl = combine(pl1, pl2) | |
159 </pre></div> | |
160 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. | |
161 </p> | |
162 | |
163 | |
164 </p> | |
165 | |
166 <br> | |
167 <br> | |
168 <table class="nav" summary="Navigation aid" border="0" width= | |
169 "100%" cellpadding="0" cellspacing="0"> | |
170 <tr valign="top"> | |
171 <td align="left" width="20"><a href="plist_intro.html"><img src= | |
172 "b_prev.gif" border="0" align="bottom" alt= | |
173 "Parameter Lists"></a> </td> | |
174 | |
175 <td align="left">Parameter Lists</td> | |
176 | |
177 <td> </td> | |
178 | |
179 <td align="right">Simulation/modelling</td> | |
180 | |
181 <td align="right" width="20"><a href= | |
182 "sim_model.html"><img src="b_next.gif" border="0" align= | |
183 "bottom" alt="Simulation/modelling"></a></td> | |
184 </tr> | |
185 </table><br> | |
186 | |
187 <p class="copy">©LTP Team</p> | |
188 </body> | |
189 </html> |