source: MML/trunk/mml/doc_html/mml/switch2physics.html @ 4

Last change on this file since 4 was 4, checked in by zhangj, 10 years ago

Initial import--MML version from SOLEIL@2013

File size: 7.1 KB
Line 
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 switch2physics</title>
6  <meta name="keywords" content="switch2physics">
7  <meta name="description" content="SWITCH2PHYSICS - Switch family to physics units">
8  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
9  <meta name="generator" content="m2html &copy; 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> &gt;  <a href="index.html">mml</a> &gt; switch2physics.m</div>
16
17<!--<table width="100%"><tr><td align="left"><a href="../index.html"><img alt="<" border="0" src="../left.png">&nbsp;Master index</a></td>
18<td align="right"><a href="index.html">Index for mml&nbsp;<img alt=">" border="0" src="../right.png"></a></td></tr></table>-->
19
20<h1>switch2physics
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>SWITCH2PHYSICS - Switch family to physics units</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 ErrorFlag = switch2physics(Family) </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">SWITCH2PHYSICS - Switch family to physics units
31
32   ErrorFlag = switch2physics(Family)
33
34   Family - Family name string
35            Matrix of family name strings
36            Cell array of family name strings
37            {Default: All families}
38
39   ErrorFlag - Number of errors that occurred
40
41   See Also <a href="switch2hardware.html" class="code" title="function ErrorFlag = switch2hardware(Family)">switch2hardware</a>, <a href="switch2hw.html" class="code" title="function ErrorFlag = switch2hw(varargin)">switch2hw</a></pre></div>
42
43<!-- crossreference -->
44<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
45This function calls:
46<ul style="list-style-image:url(../matlabicon.gif)">
47<li><a href="getfamilydata.html" class="code" title="function [Data, ErrorFlag] = getfamilydata(Family, Field1, Field2, DeviceList)">getfamilydata</a>  GETFAMILYDATA - Gets data associated with the accelerator control</li><li><a href="getfamilylist.html" class="code" title="function  [Families, AO] = getfamilylist(OutputFlag)">getfamilylist</a>      GETFAMILYLIST - Returns a list of all the family names</li><li><a href="setfamilydata.html" class="code" title="function setfamilydata(Data, Family, Field1, Field2, DeviceList)">setfamilydata</a>     SETFAMILYDATA - Sets data associated with accelerator control</li></ul>
48This function is called by:
49<ul style="list-style-image:url(../matlabicon.gif)">
50<li><a href="switchunits.html" class="code" title="function Units = switchunits(varargin)">switchunits</a>      SWITCHUNITS - Change the units field  for all families in the MML</li></ul>
51<!-- crossreference -->
52
53
54<h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
55<div class="fragment"><pre>0001 <a name="_sub0" href="#_subfunctions" class="code">function ErrorFlag = switch2physics(Family)</a>
560002 <span class="comment">%SWITCH2PHYSICS - Switch family to physics units</span>
570003 <span class="comment">%</span>
580004 <span class="comment">%   ErrorFlag = switch2physics(Family)</span>
590005 <span class="comment">%</span>
600006 <span class="comment">%   Family - Family name string</span>
610007 <span class="comment">%            Matrix of family name strings</span>
620008 <span class="comment">%            Cell array of family name strings</span>
630009 <span class="comment">%            {Default: All families}</span>
640010 <span class="comment">%</span>
650011 <span class="comment">%   ErrorFlag - Number of errors that occurred</span>
660012 <span class="comment">%</span>
670013 <span class="comment">%   See Also switch2hardware, switch2hw</span>
680014
690015 <span class="comment">%</span>
700016 <span class="comment">%   Written by Gregory J. Portmann</span>
710017
720018
730019 ErrorFlag = 0;
740020
750021 <span class="keyword">if</span> nargin == 0
760022     Family = <a href="getfamilylist.html" class="code" title="function  [Families, AO] = getfamilylist(OutputFlag)">getfamilylist</a>;
770023 <span class="keyword">end</span>
780024 <span class="keyword">if</span> isempty(Family)
790025     Family = <a href="getfamilylist.html" class="code" title="function  [Families, AO] = getfamilylist(OutputFlag)">getfamilylist</a>;
800026 <span class="keyword">end</span>
810027
820028
830029 <span class="keyword">if</span> ischar(Family)
840030     <span class="keyword">for</span> i = 1:size(Family,1)
850031         FamilyNameCell(i) = {deblank(Family(i,:))};
860032     <span class="keyword">end</span>
870033 <span class="keyword">elseif</span> iscell(Family)
880034     FamilyNameCell = Family;
890035 <span class="keyword">else</span>
900036     error(<span class="string">'Familyname input must be empty, a string matrix, or a cell array of strings'</span>);
910037 <span class="keyword">end</span>
920038
930039
940040 <span class="keyword">for</span> i = 1:length(FamilyNameCell)
950041     AOFamily = <a href="getfamilydata.html" class="code" title="function [Data, ErrorFlag] = getfamilydata(Family, Field1, Field2, DeviceList)">getfamilydata</a>(FamilyNameCell{i});
960042     <span class="keyword">try</span>
970043         AllFields = fieldnames(AOFamily);
980044         <span class="keyword">for</span> j = 1:length(AllFields)
990045             <span class="keyword">if</span> isfield(AOFamily.(AllFields{j}),<span class="string">'Units'</span>)
1000046                 <a href="setfamilydata.html" class="code" title="function setfamilydata(Data, Family, Field1, Field2, DeviceList)">setfamilydata</a>(<span class="string">'Physics'</span>, AOFamily.FamilyName, AllFields{j}, <span class="string">'Units'</span>);
1010047             <span class="keyword">end</span>
1020048         <span class="keyword">end</span>
1030049     <span class="keyword">catch</span>
1040050         ErrorFlag = ErrorFlag + 1;
1050051         fprintf(<span class="string">'   Error switching %s family to physics units, hence ignored (switch2physics)\n'</span>, FamilyNameCell{i});       
1060052     <span class="keyword">end</span>
1070053 <span class="keyword">end</span>
1080054
1090055
1100056 <span class="keyword">if</span> ~ErrorFlag
1110057     <span class="keyword">if</span> length(FamilyNameCell) == 1
1120058         fprintf(<span class="string">'   Switched %s family to physics units (%s)\n'</span>, FamilyNameCell{1}, datestr(clock,0));
1130059     <span class="keyword">else</span>
1140060         fprintf(<span class="string">'   Switched %d families to physics units (%s)\n'</span>, length(FamilyNameCell)-ErrorFlag, datestr(clock,0));
1150061     <span class="keyword">end</span>
1160062 <span class="keyword">end</span>
1170063</pre></div>
118<hr><address>Generated on Mon 21-May-2007 15:29:18 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/">m2html</a></strong> &copy; 2003</address>
119</body>
120</html>
Note: See TracBrowser for help on using the repository browser.