1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" |
---|
2 | "http://www.w3.org/TR/REC-html40/loose.dtd"> |
---|
3 | <html> |
---|
4 | <head> |
---|
5 | <title>Description of getmaxsp</title> |
---|
6 | <meta name="keywords" content="getmaxsp"> |
---|
7 | <meta name="description" content="GETMAXSP - Maximum value of the setpoint"> |
---|
8 | <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> |
---|
9 | <meta name="generator" content="m2html © 2003 Guillaume Flandin"> |
---|
10 | <meta name="robots" content="index, follow"> |
---|
11 | <link type="text/css" rel="stylesheet" href="../../../m2html.css"> |
---|
12 | </head> |
---|
13 | <body> |
---|
14 | <a name="_top"></a> |
---|
15 | <div><a href="../../../index.html">Home</a> > <a href="#">machine</a> > <a href="#">Soleil</a> > <a href="index.html">common</a> > getmaxsp.m</div> |
---|
16 | |
---|
17 | <!--<table width="100%"><tr><td align="left"><a href="../../../index.html"><img alt="<" border="0" src="../../../left.png"> Master index</a></td> |
---|
18 | <td align="right"><a href="index.html">Index for machine/Soleil/common <img alt=">" border="0" src="../../../right.png"></a></td></tr></table>--> |
---|
19 | |
---|
20 | <h1>getmaxsp |
---|
21 | </h1> |
---|
22 | |
---|
23 | <h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../../../up.png"></a></h2> |
---|
24 | <div class="box"><strong>GETMAXSP - Maximum value of the setpoint</strong></div> |
---|
25 | |
---|
26 | <h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../../../up.png"></a></h2> |
---|
27 | <div class="box"><strong>function S = getmaxsp(Family, DeviceList) </strong></div> |
---|
28 | |
---|
29 | <h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../../../up.png"></a></h2> |
---|
30 | <div class="fragment"><pre class="comment">GETMAXSP - Maximum value of the setpoint |
---|
31 | |
---|
32 | FamilyName/DeviceList Method |
---|
33 | SPmax = getmaxsp(Family, DeviceList) |
---|
34 | SPmax = getmaxsp(DataStructure) |
---|
35 | |
---|
36 | ChannelName Method |
---|
37 | SPmax = getmaxsp(ChannelNames) |
---|
38 | |
---|
39 | CommonName Method |
---|
40 | SPmax = getmaxsp(Family, CommonName) |
---|
41 | |
---|
42 | INPUTS |
---|
43 | 1. Family = Family Name |
---|
44 | Data Structure |
---|
45 | Accelerator Object |
---|
46 | Cell Array of Accelerator Objects or Family Names |
---|
47 | For CommonNames, Family=[] searches all families |
---|
48 | ChannelName = Channel access channel name |
---|
49 | Matrix of channel names |
---|
50 | Cell array of channel names |
---|
51 | CommonName = Common name |
---|
52 | Matrix of common names |
---|
53 | Cell array of common names |
---|
54 | 2. DeviceList = [Sector Device #] or [element #] list {default or empty list: whole family} |
---|
55 | Cell Array of DeviceList |
---|
56 | |
---|
57 | OUTPUTS |
---|
58 | 1. SPmax = Maximum setpoint of the device |
---|
59 | Empty if not found |
---|
60 | |
---|
61 | See also <a href="getminsp.html" class="code" title="function S = getminsp(Family, DeviceList)">getminsp</a>, getfamilydata(Family, Field, 'Range')</pre></div> |
---|
62 | |
---|
63 | <!-- crossreference --> |
---|
64 | <h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../../../up.png"></a></h2> |
---|
65 | This function calls: |
---|
66 | <ul style="list-style-image:url(../../../matlabicon.gif)"> |
---|
67 | <li><a href="getmaxsp.html" class="code" title="function S = getmaxsp(Family, DeviceList)">getmaxsp</a> GETMAXSP - Maximum value of the setpoint</li></ul> |
---|
68 | This function is called by: |
---|
69 | <ul style="list-style-image:url(../../../matlabicon.gif)"> |
---|
70 | <li><a href="getmaxsp.html" class="code" title="function S = getmaxsp(Family, DeviceList)">getmaxsp</a> GETMAXSP - Maximum value of the setpoint</li><li><a href="optics_LT1_LT2.html" class="code" title="function varargout = optics_LT1_LT2(varargin)">optics_LT1_LT2</a> OPTICS_LT1_LT2 - M-file for optics_LT1_LT2.fig</li></ul> |
---|
71 | <!-- crossreference --> |
---|
72 | |
---|
73 | |
---|
74 | <h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../../../up.png"></a></h2> |
---|
75 | <div class="fragment"><pre>0001 <a name="_sub0" href="#_subfunctions" class="code">function S = getmaxsp(Family, DeviceList)</a> |
---|
76 | 0002 <span class="comment">%GETMAXSP - Maximum value of the setpoint</span> |
---|
77 | 0003 <span class="comment">%</span> |
---|
78 | 0004 <span class="comment">% FamilyName/DeviceList Method</span> |
---|
79 | 0005 <span class="comment">% SPmax = getmaxsp(Family, DeviceList)</span> |
---|
80 | 0006 <span class="comment">% SPmax = getmaxsp(DataStructure)</span> |
---|
81 | 0007 <span class="comment">%</span> |
---|
82 | 0008 <span class="comment">% ChannelName Method</span> |
---|
83 | 0009 <span class="comment">% SPmax = getmaxsp(ChannelNames)</span> |
---|
84 | 0010 <span class="comment">%</span> |
---|
85 | 0011 <span class="comment">% CommonName Method</span> |
---|
86 | 0012 <span class="comment">% SPmax = getmaxsp(Family, CommonName)</span> |
---|
87 | 0013 <span class="comment">%</span> |
---|
88 | 0014 <span class="comment">% INPUTS</span> |
---|
89 | 0015 <span class="comment">% 1. Family = Family Name</span> |
---|
90 | 0016 <span class="comment">% Data Structure</span> |
---|
91 | 0017 <span class="comment">% Accelerator Object</span> |
---|
92 | 0018 <span class="comment">% Cell Array of Accelerator Objects or Family Names</span> |
---|
93 | 0019 <span class="comment">% For CommonNames, Family=[] searches all families</span> |
---|
94 | 0020 <span class="comment">% ChannelName = Channel access channel name</span> |
---|
95 | 0021 <span class="comment">% Matrix of channel names</span> |
---|
96 | 0022 <span class="comment">% Cell array of channel names</span> |
---|
97 | 0023 <span class="comment">% CommonName = Common name</span> |
---|
98 | 0024 <span class="comment">% Matrix of common names</span> |
---|
99 | 0025 <span class="comment">% Cell array of common names</span> |
---|
100 | 0026 <span class="comment">% 2. DeviceList = [Sector Device #] or [element #] list {default or empty list: whole family}</span> |
---|
101 | 0027 <span class="comment">% Cell Array of DeviceList</span> |
---|
102 | 0028 <span class="comment">%</span> |
---|
103 | 0029 <span class="comment">% OUTPUTS</span> |
---|
104 | 0030 <span class="comment">% 1. SPmax = Maximum setpoint of the device</span> |
---|
105 | 0031 <span class="comment">% Empty if not found</span> |
---|
106 | 0032 <span class="comment">%</span> |
---|
107 | 0033 <span class="comment">% See also getminsp, getfamilydata(Family, Field, 'Range')</span> |
---|
108 | 0034 |
---|
109 | 0035 <span class="comment">%</span> |
---|
110 | 0036 <span class="comment">% Written by Gregory J. Portmann</span> |
---|
111 | 0037 <span class="comment">% Modified by Laurent S. Nadolski</span> |
---|
112 | 0038 |
---|
113 | 0039 S = []; |
---|
114 | 0040 |
---|
115 | 0041 <span class="keyword">if</span> nargin == 0 |
---|
116 | 0042 error(<span class="string">'At least one input required'</span>); |
---|
117 | 0043 <span class="keyword">end</span> |
---|
118 | 0044 |
---|
119 | 0045 <span class="keyword">if</span> iscell(Family) |
---|
120 | 0046 <span class="keyword">if</span> nargin >= 2 |
---|
121 | 0047 <span class="keyword">if</span> ~iscell(DeviceList) |
---|
122 | 0048 error(<span class="string">'If Family is a cell array, then DeviceList must be a cell array.'</span>); |
---|
123 | 0049 <span class="keyword">end</span> |
---|
124 | 0050 <span class="keyword">if</span> length(Family) ~= length(DeviceList) |
---|
125 | 0051 error(<span class="string">'Family and DeviceList must be the same size cell arrays.'</span>); |
---|
126 | 0052 <span class="keyword">end</span> |
---|
127 | 0053 <span class="keyword">end</span> |
---|
128 | 0054 |
---|
129 | 0055 <span class="keyword">for</span> i = 1:length(Family) |
---|
130 | 0056 <span class="keyword">if</span> nargin == 1 |
---|
131 | 0057 S{i} = <a href="getmaxsp.html" class="code" title="function S = getmaxsp(Family, DeviceList)">getmaxsp</a>(Family{i}); |
---|
132 | 0058 <span class="keyword">else</span> |
---|
133 | 0059 S{i} = <a href="getmaxsp.html" class="code" title="function S = getmaxsp(Family, DeviceList)">getmaxsp</a>(Family{i}, DeviceList{i}); |
---|
134 | 0060 <span class="keyword">end</span> |
---|
135 | 0061 <span class="keyword">end</span> |
---|
136 | 0062 <span class="keyword">return</span> |
---|
137 | 0063 <span class="keyword">end</span> |
---|
138 | 0064 |
---|
139 | 0065 <span class="keyword">if</span> isstruct(Family) |
---|
140 | 0066 <span class="keyword">if</span> any(size(Family) > 1) |
---|
141 | 0067 error(<span class="string">'Only structures of size = [1 1] allowed'</span>) |
---|
142 | 0068 <span class="keyword">end</span> |
---|
143 | 0069 <span class="keyword">if</span> isfield(Family,<span class="string">'FamilyName'</span>) & isfield(Family,<span class="string">'Field'</span>) |
---|
144 | 0070 <span class="comment">% Data structure</span> |
---|
145 | 0071 S = getfamilydata(Family.FamilyName, Family.Field, <span class="string">'Range'</span>, Family.DeviceList); |
---|
146 | 0072 <span class="keyword">if</span> ~isempty(S) |
---|
147 | 0073 S = S(:,2); |
---|
148 | 0074 <span class="keyword">end</span> |
---|
149 | 0075 <span class="keyword">return</span> |
---|
150 | 0076 <span class="keyword">else</span> |
---|
151 | 0077 <span class="comment">% AO structure</span> |
---|
152 | 0078 <span class="keyword">if</span> nargin < 2 |
---|
153 | 0079 S = Family.Setpoint.Range; |
---|
154 | 0080 <span class="keyword">else</span> |
---|
155 | 0081 <span class="keyword">if</span> size(DeviceList,2) == 1 |
---|
156 | 0082 Index = findrowindex(DeviceList, ElementList); |
---|
157 | 0083 <span class="keyword">else</span> |
---|
158 | 0084 Index = findrowindex(DeviceList, Family.DeviceList); |
---|
159 | 0085 <span class="keyword">end</span> |
---|
160 | 0086 S = Family.Setpoint.Range(Index,2); |
---|
161 | 0087 <span class="keyword">end</span> |
---|
162 | 0088 <span class="keyword">end</span> |
---|
163 | 0089 <span class="keyword">end</span> |
---|
164 | 0090 |
---|
165 | 0091 |
---|
166 | 0092 <span class="keyword">if</span> isempty(Family) |
---|
167 | 0093 <span class="comment">% Common names with no family name</span> |
---|
168 | 0094 <span class="keyword">if</span> nargin < 2 |
---|
169 | 0095 error(<span class="string">'If Family=[], 2 inputs are required.'</span>); |
---|
170 | 0096 <span class="keyword">end</span> |
---|
171 | 0097 CommonNames = DeviceList; |
---|
172 | 0098 <span class="keyword">for</span> i = 1:size(CommonNames,1) |
---|
173 | 0099 Family = common2family(CommonNames(i,:)); |
---|
174 | 0100 [FamilyIndex, ACCELERATOR_OBJECT] = isfamily(Family); |
---|
175 | 0101 DeviceList = common2dev(CommonNames(i,:), ACCELERATOR_OBJECT); |
---|
176 | 0102 <span class="keyword">if</span> isempty(DeviceList) | isempty(DeviceList) |
---|
177 | 0103 error(<span class="string">'Common name could not be converted to a Family and DeviceList.'</span>); |
---|
178 | 0104 <span class="keyword">end</span> |
---|
179 | 0105 S(i,:) = <a href="getmaxsp.html" class="code" title="function S = getmaxsp(Family, DeviceList)">getmaxsp</a>(Family, DeviceList); |
---|
180 | 0106 <span class="keyword">end</span> |
---|
181 | 0107 <span class="keyword">return</span> |
---|
182 | 0108 |
---|
183 | 0109 <span class="keyword">elseif</span> ~isfamily(Family(1,:)) |
---|
184 | 0110 <span class="comment">% Channel name method</span> |
---|
185 | 0111 <span class="comment">% Try to convert to a family and device</span> |
---|
186 | 0112 |
---|
187 | 0113 ChannelNames = Family; |
---|
188 | 0114 <span class="keyword">for</span> i = 1:size(ChannelNames,1) |
---|
189 | 0115 Family = channel2family(ChannelNames(i,:)); |
---|
190 | 0116 [FamilyIndex, ACCELERATOR_OBJECT] = isfamily(Family); |
---|
191 | 0117 DeviceList = channel2dev(ChannelNames(i,:), ACCELERATOR_OBJECT); |
---|
192 | 0118 <span class="keyword">if</span> isempty(DeviceList) | isempty(DeviceList) |
---|
193 | 0119 error(<span class="string">'Channel name could not be converted to a Family and DeviceList.'</span>); |
---|
194 | 0120 <span class="keyword">end</span> |
---|
195 | 0121 S(i,:) = <a href="getmaxsp.html" class="code" title="function S = getmaxsp(Family, DeviceList)">getmaxsp</a>(Family, DeviceList); |
---|
196 | 0122 <span class="keyword">end</span> |
---|
197 | 0123 <span class="keyword">return</span> |
---|
198 | 0124 <span class="keyword">end</span> |
---|
199 | 0125 |
---|
200 | 0126 |
---|
201 | 0127 <span class="keyword">if</span> nargin == 1 |
---|
202 | 0128 S = getfamilydata(Family, <span class="string">'Setpoint'</span>, <span class="string">'Range'</span>, []); |
---|
203 | 0129 <span class="keyword">else</span> |
---|
204 | 0130 <span class="comment">% Convert common name to a DeviceList</span> |
---|
205 | 0131 <span class="keyword">if</span> isstr(DeviceList) |
---|
206 | 0132 DeviceList = common2dev(DeviceList, Family); |
---|
207 | 0133 <span class="keyword">end</span> |
---|
208 | 0134 S = getfamilydata(Family, <span class="string">'Setpoint'</span>, <span class="string">'Range'</span>, DeviceList); |
---|
209 | 0135 <span class="keyword">end</span> |
---|
210 | 0136 <span class="keyword">if</span> ~isempty(S) |
---|
211 | 0137 S = S(:,2); |
---|
212 | 0138 <span class="keyword">end</span></pre></div> |
---|
213 | <hr><address>Generated on Mon 21-May-2007 15:35:27 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/">m2html</a></strong> © 2003</address> |
---|
214 | </body> |
---|
215 | </html> |
---|