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 getfamilydata</title> |
---|
6 | <meta name="keywords" content="getfamilydata"> |
---|
7 | <meta name="description" content="GETFAMILYDATA - Gets data associated with the accelerator control"> |
---|
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="index.html">mml</a> > getfamilydata.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 mml <img alt=">" border="0" src="../right.png"></a></td></tr></table>--> |
---|
19 | |
---|
20 | <h1>getfamilydata |
---|
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>GETFAMILYDATA - Gets data associated with the accelerator control</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 [Data, ErrorFlag] = getfamilydata(Family, Field1, Field2, 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">GETFAMILYDATA - Gets data associated with the accelerator control |
---|
31 | |
---|
32 | When getting data from the accelerator object (AO): |
---|
33 | [Data, ErrorFlag] = getfamilydata(Family, Field1, Field2, DeviceList) |
---|
34 | [Data, ErrorFlag] = getfamilydata(Family, Field1, DeviceList) |
---|
35 | [Data, ErrorFlag] = getfamilydata(Family, Field1) |
---|
36 | [Data, ErrorFlag] = getfamilydata(Family) |
---|
37 | [Data, ErrorFlag] = getfamilydata |
---|
38 | |
---|
39 | When getting data from the accelerator data stucture (AD): |
---|
40 | [Data, ErrorFlag] = getfamilydata(Field1) |
---|
41 | [Data, ErrorFlag] = getfamilydata(Field1, Field2) |
---|
42 | [Data, ErrorFlag] = getfamilydata(Field1, Field2, Field3) |
---|
43 | [Data, ErrorFlag] = getfamilydata(Field1, Field2, Field3, Field4) |
---|
44 | |
---|
45 | INPUTS |
---|
46 | 1. Family = Family Name |
---|
47 | Data Structure (only the FamilyName is used) |
---|
48 | Field |
---|
49 | Accelerator Object |
---|
50 | 2. Field1 = Field name (string) |
---|
51 | 3. Field2 = Field name (string) |
---|
52 | 4. DeviceList = Device list for that family |
---|
53 | |
---|
54 | OUTPUT |
---|
55 | 1. Data = AO.Field1.Field2 or AD.Field1.Field2.Field3.Field4 |
---|
56 | Looks for Family in the accelerator data structure and returns the appropriate data. |
---|
57 | |
---|
58 | If DeviceList is not an input, then the exact contents of the field is returned |
---|
59 | If DeviceList exists, then Data is indexed according to DeviceList |
---|
60 | If DeviceList is empty, [], then the entire DeviceList is returned |
---|
61 | If DeviceList is empty, [], and the field is one row (or cell) then Data is expanded |
---|
62 | to the size of the entire DeviceList |
---|
63 | |
---|
64 | Returns [] if the data could not be found |
---|
65 | |
---|
66 | 2. ErrorFlag = 1 if the data could not be found |
---|
67 | |
---|
68 | NOTE |
---|
69 | 1. If the inputs are cell arrays, then the output is a cell array |
---|
70 | 2. If Family is a cell array, then DeviceList must also be a cell array, |
---|
71 | however, Field1 or Field2 can either be a cell array array or a string. |
---|
72 | |
---|
73 | EXAMPLES |
---|
74 | 1. getfamilydata('BPMx') |
---|
75 | 2. getfamilydata('BPMx','Monitor') |
---|
76 | 3. getfamilydata('BPMx','Monitor','Units') |
---|
77 | 4. getfamilydata('HCOR', 'Status') |
---|
78 | |
---|
79 | See Also <a href="setfamilydata.html" class="code" title="function setfamilydata(Data, Family, Field1, Field2, DeviceList)">setfamilydata</a></pre></div> |
---|
80 | |
---|
81 | <!-- crossreference --> |
---|
82 | <h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2> |
---|
83 | This function calls: |
---|
84 | <ul style="list-style-image:url(../matlabicon.gif)"> |
---|
85 | <li><a href="elem2dev.html" class="code" title="function Output = elem2dev(Family, ElementList)">elem2dev</a> ELEM2DEV - Converts a device list to an element list</li><li><a href="family2dev.html" class="code" title="function DeviceList = family2dev(Family, varargin);">family2dev</a> FAMILY2DEV - Return the device list for a family</li><li><a href="getad.html" class="code" title="function AD = getad">getad</a> GETAD - returns the Accelerator Data (AD) structure</li><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="isfamily.html" class="code" title="function [FamilyFlag, AO] = isfamily(Family, Field)">isfamily</a> ISFAMILY - True for family names</li></ul> |
---|
86 | This function is called by: |
---|
87 | <ul style="list-style-image:url(../matlabicon.gif)"> |
---|
88 | <li><a href="addmenuad.html" class="code" title="function varargout = addmenuad(h, Command)">addmenuad</a> ADDMENUAD - Menu to tune AD parameters</li><li><a href="addmenuao.html" class="code" title="function varargout = addmenuao(h, Command)">addmenuao</a> ADDMENUAO - Menu to tune AO parameters</li><li><a href="buildopsdatafiles.html" class="code" title="function buildopsdatafiles">buildopsdatafiles</a> BUILDOPSDATAFILES - Builds the files for the OpsData directory from the model</li><li><a href="cddataroot.html" class="code" title="function DirectoryName = cddataroot">cddataroot</a> CDDATAROOT - Change to the MML data directory</li><li><a href="cdopsdata.html" class="code" title="function DirectoryName = cdopsdata">cdopsdata</a> CDOPSDATA - Change to the MML operational data directory</li><li><a href="channel2common.html" class="code" title="function [CommonNames, ErrorFlag] = channel2common(ChannelNames, Field, Family)">channel2common</a> CHANNEL2COMMON - Convert a channel name to a common name</li><li><a href="channel2handle.html" class="code" title="function [Handle, ErrorFlag] = channel2handle(ChannelNames, FamilyList)">channel2handle</a> CHANNEL2HANDLE - Returns the MCA handle (obsolete)</li><li><a href="common2handle.html" class="code" title="function [Handles, ErrorFlag] = common2handle(CommonNames, Field, Family);">common2handle</a> COMMON2HANDLE - Converts a common name to a MCA handle (Obsolete function)</li><li><a href="copybpmrespfile.html" class="code" title="function copybpmrespfile(DataFileName, ToFileName)">copybpmrespfile</a> COPYBPMRESPFILE - Copies a BPM response matrix file to the golden file</li><li><a href="copybpmsigmafile.html" class="code" title="function copybpmsigmafile(DataFileName, ToFileName)">copybpmsigmafile</a> COPYBPMSIGMAFILE - Copies a BPM data file to the golden BPM sigma file</li><li><a href="copychrorespfile.html" class="code" title="function copychrorespfile(DataFileName, ToFileName)">copychrorespfile</a> COPYCHRORESPFILE - Copies a chromaticity response matrix file to the golden file</li><li><a href="copydispersionfile.html" class="code" title="function copydispersionfile(DataFileName, ToFileName)">copydispersionfile</a> COPYDISPERSIONFILE - Copies a dispersion file to golden file</li><li><a href="copydisprespfile.html" class="code" title="function copydisprespfile(DataFileName, ToFileName)">copydisprespfile</a> COPYDISPRESPFILE - Copies a dispersion response matrix file to the golden file</li><li><a href="copyinjectionconfigfile.html" class="code" title="function copyinjectionconfigfile(DataFileName, ToFileName)">copyinjectionconfigfile</a> COPYINJECTIONCONFIGFILE - Copies a lattice file to the golden injection file</li><li><a href="copymachineconfigfile.html" class="code" title="function copymachineconfigfile(DataFileName, ToFileName)">copymachineconfigfile</a> COPYMACHINECONFIGFILE - Copies a lattice file to the golden file</li><li><a href="copytunerespfile.html" class="code" title="function copytunerespfile(DataFileName, ToFileName)">copytunerespfile</a> COPYTUNERESPFILE - Copies a tune response matrix file to the golden file</li><li><a href="correctors2golden.html" class="code" title="function correctors2golden">correctors2golden</a> CORRECTORS2GOLDEN - Sets the default corrector families to the golden configuration values</li><li><a href="dev2common.html" class="code" title="function [Output, Err] = dev2common(Family, DeviceList)">dev2common</a> DEV2COMMON - Converts Device lists to common names</li><li><a href="dev2elem.html" class="code" title="function Output = dev2elem(Family, DevList)">dev2elem</a> DEV2ELEM - Converts an element list to a device list</li><li><a href="family2channel.html" class="code" title="function [ChannelNames, ErrorFlag] = family2channel(varargin);">family2channel</a> FAMILY2CHANNEL - Converts the family name to a channel name</li><li><a href="family2common.html" class="code" title="function [CommonNames, ErrorFlag] = family2common(Family, DeviceList)">family2common</a> FAMILY2COMMON - Convert a family name, device list to a common name list</li><li><a href="family2datastruct.html" class="code" title="function [DataStruct, ErrorFlag] = family2datastruct(varargin)">family2datastruct</a> FAMILY2DATASTRUCTURE - Returns a datastructure corresponding to a Family</li><li><a href="family2dev.html" class="code" title="function DeviceList = family2dev(Family, varargin);">family2dev</a> FAMILY2DEV - Return the device list for a family</li><li><a href="family2status.html" class="code" title="function [S, IndexList] = family2status(Family, DeviceList)">family2status</a> FAMILY2STATUS - Returns the device status</li><li><a href="family2tol.html" class="code" title="function [Data, ErrorFlag] = family2tol(varargin)">family2tol</a> FAMILY2TOL - Return the (SP-AM) tolerance for a family</li><li><a href="findrf1.html" class="code" title="function [DeltaRF, RFnew, frf] = findrf1(DeltaRF, BPMFamily, BPMList, FileName)">findrf1</a> FINDRF1 - Finds the RF frequency that minimizes the horizonal dispersion</li><li><a href="getao.html" class="code" title="function AO = getao(FileName)">getao</a> GETAO - returns the AcceleratorObject (AO)</li><li><a href="getbpm.html" class="code" title="function [BPM1, BPM2, FileName]=getbpm(varargin);">getbpm</a> GETBPM - Returns the horizontal and vertical orbit</li><li><a href="getbpmresp.html" class="code" title="function [S, FileName] = getbpmresp(varargin)">getbpmresp</a> GETBPMRESP - Returns the BPM response matrix in the horizontal and vertical planes</li><li><a href="getbrho.html" class="code" title="function brho = getbrho(varargin)">getbrho</a> GETBRHO - Calculations of the beam rigidity</li><li><a href="getchro.html" class="code" title="function [Data, FileName] = getchro(varargin)">getchro</a> GETCHRO - Return the chromaticity function (from file)</li><li><a href="getchroresp.html" class="code" title="function [ChromaticityMatrix, FileName] = getchroresp(varargin)">getchroresp</a> GETCHRORESP - Loads the chromaticity response vector (or matrix) for multiple sextupole families</li><li><a href="getcircumference.html" class="code" title="function C = getcircumference">getcircumference</a> GETCIRCUMFERENCE - Returns the ring circumference</li><li><a href="getcrunch.html" class="code" title="function Data = getcrunch(varargin)">getcrunch</a> GETCRUNCH- Returns the crunch values for a family (radians)</li><li><a href="getdisp.html" class="code" title="function [Data, FileName] = getdisp(varargin)">getdisp</a> GETDISP - Returns the dispersion for a family (from file)</li><li><a href="getenergy.html" class="code" title="function [Energy, HCMEnergy] = getenergy(varargin)">getenergy</a> GETENERGY - Returns the beam energy base on the bend magnet</li><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="getgain.html" class="code" title="function Data = getgain(varargin)">getgain</a> GETGAIN - Returns the gain for a family</li><li><a href="getgolden.html" class="code" title="function Data = getgolden(varargin)">getgolden</a> GETGOLDEN - Returns the golden values for a family</li><li><a href="getinjectionlattice.html" class="code" title="function [ConfigSetpoint, ConfigMonitor, FileName] = getinjectionlattice(varargin)">getinjectionlattice</a> GETINJECTIONLATTICE - Get data from the production lattice file</li><li><a href="getlattice.html" class="code" title="function [Setpoint, Monitor, FileName] = getlattice(varargin)">getlattice</a> GETLATTICE - Get data from a lattice file</li><li><a href="getmachineconfig.html" class="code" title="function [ConfigSetpoint, ConfigMonitor, FileName] = getmachineconfig(varargin)">getmachineconfig</a> GETMACHINECONFIG - Returns or saves to file the present storage ring setpoints and monitors</li><li><a href="getmachinename.html" class="code" title="function machine = getmachinename">getmachinename</a> GETMACHINENAME - Return name of the machine loaded in MML</li><li><a href="getmcf.html" class="code" title="function Alpha = getmcf(ModelString)">getmcf</a> GETMCF - Returns the momentum compaction factor (MCF) stored in the AD or the model</li><li><a href="getmemberof.html" class="code" title="function MemberOfCell = getmemberof(FamilyName, Field)">getmemberof</a> GETMEMBEROF - Returns the membership information of a family (cell of strings)</li><li><a href="getmode.html" class="code" title="function Mode = getmode(Family, Field)">getmode</a> GETMODE - Returns the present family mode ('Online', 'Simulator', 'Manual', 'Special', etc)</li><li><a href="getoffset.html" class="code" title="function Data = getoffset(varargin)">getoffset</a> GETOFFSET - Returns the offset values for a family</li><li><a href="getphysdata.html" class="code" title="function [Data, iNotFound] = getphysdata(Family, Field, DeviceList)">getphysdata</a> GETPHYSDATA - Gets physics data</li><li><a href="getproductionlattice.html" class="code" title="function [ConfigSetpoint, ConfigMonitor, FileName] = getproductionlattice(varargin)">getproductionlattice</a> GETPRODUCTIONLATTICE - Read the Golden lattice from file GoldenLattice</li><li><a href="getpv.html" class="code" title="function [AM, tout, DataTime, ErrorFlag] = getpv(varargin)">getpv</a> GETPV - Returns a variable from the online system or the model</li><li><a href="getramprate.html" class="code" title="function RampRate = getramprate(varargin)">getramprate</a> GETRAMPRATE - Returns the ramp rate for a family</li><li><a href="getrespmat.html" class="code" title="function [S, FileName] = getrespmat(varargin)">getrespmat</a> GETRESPMAT - Get response matrix data from a file</li><li><a href="getrf.html" class="code" title="function [RFsp, RFam, DataTime, ErrorFlag] = getrf(varargin)">getrf</a> GETRF - Gets the RF frequency</li><li><a href="getroll.html" class="code" title="function Data = getroll(varargin)">getroll</a> GETROLL - Returns the roll values for a family (radians)</li><li><a href="getrunflag.html" class="code" title="function [RunFlag, Delta, Tol] = getrunflag(varargin)">getrunflag</a> GETRUNFLAG - Returns position if the device is in the process of changing a setpoint</li><li><a href="getsigma.html" class="code" title="function [Data, FileName] = getsigma(varargin)">getsigma</a> GETSIGMA - Return the standard deviation in the monitor for a family</li><li><a href="getspos.html" class="code" title="function S = getspos(Family, DeviceList)">getspos</a> GETSPOS - Returns the longitudinal position in meters</li><li><a href="getsubmachinename.html" class="code" title="function machine = getmachinename">getsubmachinename</a> GETMACHINENAME - Return name of the machine loaded in MML</li><li><a href="gettune.html" class="code" title="function [Tune, tout, DataTime, ErrorFlag] = gettune(varargin)">gettune</a> GETTUNE - Returns the betatron tunes</li><li><a href="gettuneresp.html" class="code" title="function [TuneMatrix, FileName] = gettuneresp(varargin)">gettuneresp</a> GETTUNERESP - Loads the tune response vector (or matrix) for multiple quadrupole families</li><li><a href="getunits.html" class="code" title="function [Units, UnitsString] = getunits(Family, Field)">getunits</a> GETUNITS - Return the present family units and units string</li><li><a href="getx.html" class="code" title="function [AM, tout, DataTime, ErrorFlag] = getx(varargin)">getx</a> GETX - Returns the horizontal orbit</li><li><a href="gety.html" class="code" title="function [AM, tout, DataTime, ErrorFlag] = gety(varargin)">gety</a> GETY - Returns the vertical orbit</li><li><a href="golden2sim.html" class="code" title="function golden2sim(ZeroCMFlag)">golden2sim</a> GOLDEN2SIM - loads online machine configuration to AT configuration</li><li><a href="gotodataroot.html" class="code" title="function gotodataroot">gotodataroot</a> GOTODATAROOT - Change directory to the data root directory</li><li><a href="hw2physics.html" class="code" title="function S = hw2physics(Family, Field, value, DeviceList, Energy)">hw2physics</a> HW2PHYSICS - Converts from 'Hardware' units to 'Physics' units</li><li><a href="isbooster.html" class="code" title="function Test = isbooster">isbooster</a> ISBOOSTER - Is this a booster ring?</li><li><a href="isstoragering.html" class="code" title="function Test = isstoragering">isstoragering</a> ISSTORAGERING - Is this a storage ring?</li><li><a href="istransport.html" class="code" title="function Test = istransport">istransport</a> ISTRANSPORT - Is this a transport line?</li><li><a href="loadao.html" class="code" title="function loadao(FileName)">loadao</a> LOADAO - Loads the AO and AD from a .mat file</li><li><a href="loadorbit.html" class="code" title="function varargout = loadorbit(varargin)">loadorbit</a> LOADORBIT - Loads orbit by file/directory specification - or - Golden %orbit by default</li><li><a href="makebump.html" class="code" title="function OCS = makebump(varargin)">makebump</a> MAKEBUMP - Creates and orbit correction structure (OCS) usable by setorbit</li><li><a href="makephysdata.html" class="code" title="function makephysdata(varargin)">makephysdata</a> MAKEPHYSDATA - Make a starting physics data file</li><li><a href="maxpv.html" class="code" title="function [Data, ErrorFlag] = maxpv(varargin)">maxpv</a> MAXPV - Maximum value of a process variable</li><li><a href="measbpmresp.html" class="code" title="function [Rmat, OutputFileName] = measbpmresp(varargin)">measbpmresp</a> MEASBPMRESP - Measures the BPM response matrix in the horizontal and vertical planes</li><li><a href="measbpmresplinearity.html" class="code" title="function measbpmresplinearity(CMFamily, mm, CMDeviceList, XAxisFlag)">measbpmresplinearity</a> MEASBPMRESPLINEARITY - Compute BPMlinearity</li><li><a href="measchro.html" class="code" title="function [Chromaticity, FileName] = measchro(varargin)">measchro</a> MEASCHRO - measures the chromaticity function emperically</li><li><a href="measchroresp.html" class="code" title="function [Rmat, OutputFileName] = measchroresp(varargin)">measchroresp</a> MEASCHRORESP - measures the response from sextupoles to chromaticity</li><li><a href="meascmhysteresis.html" class="code" title="function meascmhysteresis(BPMList, CMFamily, CMList, MaxChange, NSteps)">meascmhysteresis</a> MEASCMHYSTERESIS - Measure corrector magnet hysteresis</li><li><a href="measdisp.html" class="code" title="function [Dx, Dy, FileName] = measdisp(varargin);">measdisp</a> MEASDISP - Measures the dispersion function</li><li><a href="measidfftable.html" class="code" title="function ffgettbl(Sector, BPMFlag)">measidfftable</a> FFGETTBL - Measures an insertion device feed forward table for the vertical gap</li><li><a href="measlocodata.html" class="code" title="function measlocodata(varargin)">measlocodata</a> MEASLOCODATA - Measures a set of LOCO data</li><li><a href="measrespmat.html" class="code" title="function S = measrespmat(varargin)">measrespmat</a> MEASRESPMAT - Measure a response matrix</li><li><a href="meastuneresp.html" class="code" title="function [Rmat, OutputFileName] = meastuneresp(varargin)">meastuneresp</a> MEASTUNERESP - Measures the response from quadrupole to tune</li><li><a href="minpv.html" class="code" title="function [Data, ErrorFlag] = minpv(varargin)">minpv</a> MinPV - Maximum value of a process variable</li><li><a href="monmags.html" class="code" title="function [MagnetSetpoints, MagnetMonitors, BPMMonitors, MagnetSetpointsEnd, FileName] = monmags(varargin)">monmags</a> MONMAGS - Monitors all magnet power supplies and plots various statistics</li><li><a href="orbitcorrectionmethods.html" class="code" title="function [OCS, SmatNoWeights, S, U, V] = orbitcorrectionmethods(OCS, Smat, S, U, V)">orbitcorrectionmethods</a> ORBITCORRECTIONMETHODS - Some the orbit correction methods used on light sources</li><li><a href="physics2hw.html" class="code" title="function S = physics2hw(Family, Field, value, DeviceList, Energy)">physics2hw</a> PHYSICS2HW - Converts from 'Physics' units to 'Hardware' units</li><li><a href="plotbpmrespsym.html" class="code" title="function plotbpmrespsym(R)">plotbpmrespsym</a> PLOTBPMRESPSYM - Looks for symmetry of the orbit response matrix</li><li><a href="plotcm.html" class="code" title="function [DeltaRF, HCMEnergyChangeTotal, DeltaL] = plotcm(varargin)">plotcm</a> PLOTCM - Plots the horizontal and vertical corrector magnet families and</li><li><a href="plotgoldenorbit.html" class="code" title="function plotgoldenorbit(varargin)">plotgoldenorbit</a> PLOTGOLDENORBIT - Plots the golden orbit</li><li><a href="plotidfftable.html" class="code" title="function FigureHandles = plotidfftable(Sector, GeV)">plotidfftable</a> PLOTIDFFTABLE - Plots various information about the feed forward tables</li><li><a href="plotlattice.html" class="code" title="function plotlattice(varargin)">plotlattice</a> PLOTLATTICE - Plot the lattice</li><li><a href="plotoffsetorbit.html" class="code" title="function plotoffsetorbit(varargin)">plotoffsetorbit</a> PLOTOFFSETORBIT - Plots the offset orbit</li><li><a href="plotorbit.html" class="code" title="function plotorbit(varargin)">plotorbit</a> PLOTORBIT - Plot the present orbit w.r.t. the golden or offset orbit</li><li><a href="plotorbitdata.html" class="code" title="function [BPMx, BPMy] = plotorbitdata(varargin)">plotorbitdata</a> PLOTORBITDATA - Plots BPM statistics</li><li><a href="quad2bpm.html" class="code" title="function [BPMFamilyOutput, BPMDevOutput, DeltaSpos, PhaseAdvance] = quad2bpm(QUADFamily, QUADDev, LocationFlag)">quad2bpm</a> QUAD2BPM - Returns the nearest BPM to the specified quadrupole</li><li><a href="quadcenter.html" class="code" title="function [QMS1, QMS2] = quadcenter(QuadFamily, QuadDev, XYPlane, FigureHandle)">quadcenter</a> QUADCENTER - Measure the magnet center of a quadrupole magnet</li><li><a href="quadcenterinit.html" class="code" title="function QMS = quadcenterinit(QuadFamily, QuadDev, QuadPlane)">quadcenterinit</a> QMS = quadcenterinit(Family, Device, QuadPlane)</li><li><a href="quadgetdata.html" class="code" title="function [X, Y, BPMxFamily, QUADxFamily, BPMyFamily, QUADyFamily, DateMatX, DateMatY] = quadgetdata(DirName, PlotFlag)">quadgetdata</a> QUADGETDATA - Collect the date from a quadrupole center run.</li><li><a href="quadplot.html" class="code" title="function [QMS, WarningString] = quadplot(Input1, FigureHandle, sigmaBPM)">quadplot</a> QUADPLOT - Plots quadrupole centering data</li><li><a href="quadplotall.html" class="code" title="function [Xnew, Ynew, BPMxFamily, QUADxFamily, BPMyFamily, QUADyFamily, DateMatX, DateMatY] = quadplotall(DirName, PlotFlag)">quadplotall</a> QUADPLOTALL - Collect the date from a quadrupole center run.</li><li><a href="quadplotphysics.html" class="code" title="function [QMS, WarningString] = quadplotphysics(Input1, FigureHandle, sigmaBPM)">quadplotphysics</a> QUADPLOTPHYSICS - Plots quadrupole centering data in physics units</li><li><a href="saveao.html" class="code" title="function saveao(FileName)">saveao</a> SAVEAO - Saves the AO and AD to a .mat file</li><li><a href="savegoldenorbit.html" class="code" title="function savegoldenorbit(FileName)">savegoldenorbit</a> SAVEGOLDENORBIT - Save present orbit as golden orbit into a file</li><li><a href="saveoffsetorbit.html" class="code" title="function saveoffsetorbit(FileName)">saveoffsetorbit</a> SAVEOFFSETORBIT - Save offset orbit into file</li><li><a href="setao.html" class="code" title="function setao(AO)">setao</a> SETAO - Set Accelerator Object (AO)</li><li><a href="setenergy.html" class="code" title="function [ConfigSetpointEnd, ConfigSetpointStart, ConfigSetpointPhysics] = setenergy(varargin)">setenergy</a> SETENERGY - Sets the storage ring energy (GeV) by ramping all lattice magnets</li><li><a href="setgolden.html" class="code" title="function varargout = setgolden(varargin)">setgolden</a> SETGOLDEN - Set the golden values</li><li><a href="setmachineconfig.html" class="code" title="function [ConfigSetpoint, FileName] = setmachineconfig(varargin)">setmachineconfig</a> SETMACHINECONFIG - Sets the storage ring setpoints from a file or configuration data structure</li><li><a href="setoffset.html" class="code" title="function varargout = setoffset(varargin)">setoffset</a> SETOFFSET - Set the offset</li><li><a href="setorbit.html" class="code" title="function [OCS, OCS0, V, S, ErrorFlag] = setorbit(varargin)">setorbit</a> SETORBIT - Orbit correction function</li><li><a href="setorbitbump.html" class="code" title="function [OCS, OCS0, V, S, ErrorFlag] = setorbitbump(varargin)">setorbitbump</a> SETORBITBUMP - Local bump program (uses setorbit)</li><li><a href="setphysdata.html" class="code" title="function setphysdata(varargin)">setphysdata</a> SETPHYSDATA - Set physics data</li><li><a href="setpv.html" class="code" title="function ErrorFlag = setpv(varargin)">setpv</a> SETPV - Setpoint change of the online system or model</li><li><a href="setrf.html" class="code" title="function setrf(RF, varargin)">setrf</a> SETRF - Sets the RF frequency</li><li><a href="switch2hardware.html" class="code" title="function ErrorFlag = switch2hardware(Family)">switch2hardware</a> SWITCH2HARDWARE - Switch family to hardware units</li><li><a href="switch2manual.html" class="code" title="function ErrorFlag = switch2manual(Family)">switch2manual</a> SWITCH2MANUAL - Switch family to manual mode.</li><li><a href="switch2online.html" class="code" title="function ErrorFlag = switch2online(Family, DisplayFlag)">switch2online</a> SWITCH2ONLINE - Switch family to online mode</li><li><a href="switch2physics.html" class="code" title="function ErrorFlag = switch2physics(Family)">switch2physics</a> SWITCH2PHYSICS - Switch family to physics units</li><li><a href="switch2sim.html" class="code" title="function ErrorFlag = switch2sim(Family, DisplayFlag)">switch2sim</a> SWITCH2SIM - Switch family to simulator mode if the family is in online mode.</li><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> |
---|
89 | <!-- crossreference --> |
---|
90 | |
---|
91 | <h2><a name="_subfunctions"></a>SUBFUNCTIONS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2> |
---|
92 | <ul style="list-style-image:url(../matlabicon.gif)"> |
---|
93 | <li><a href="#_sub1" class="code">function Data = sortdatabydevicelist(Data, DeviceList, DeviceListTotal)</a></li></ul> |
---|
94 | <h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2> |
---|
95 | <div class="fragment"><pre>0001 <a name="_sub0" href="#_subfunctions" class="code">function [Data, ErrorFlag] = getfamilydata(Family, Field1, Field2, DeviceList)</a> |
---|
96 | 0002 <span class="comment">%GETFAMILYDATA - Gets data associated with the accelerator control</span> |
---|
97 | 0003 <span class="comment">%</span> |
---|
98 | 0004 <span class="comment">% When getting data from the accelerator object (AO):</span> |
---|
99 | 0005 <span class="comment">% [Data, ErrorFlag] = getfamilydata(Family, Field1, Field2, DeviceList)</span> |
---|
100 | 0006 <span class="comment">% [Data, ErrorFlag] = getfamilydata(Family, Field1, DeviceList)</span> |
---|
101 | 0007 <span class="comment">% [Data, ErrorFlag] = getfamilydata(Family, Field1)</span> |
---|
102 | 0008 <span class="comment">% [Data, ErrorFlag] = getfamilydata(Family)</span> |
---|
103 | 0009 <span class="comment">% [Data, ErrorFlag] = getfamilydata</span> |
---|
104 | 0010 <span class="comment">%</span> |
---|
105 | 0011 <span class="comment">% When getting data from the accelerator data stucture (AD):</span> |
---|
106 | 0012 <span class="comment">% [Data, ErrorFlag] = getfamilydata(Field1)</span> |
---|
107 | 0013 <span class="comment">% [Data, ErrorFlag] = getfamilydata(Field1, Field2)</span> |
---|
108 | 0014 <span class="comment">% [Data, ErrorFlag] = getfamilydata(Field1, Field2, Field3)</span> |
---|
109 | 0015 <span class="comment">% [Data, ErrorFlag] = getfamilydata(Field1, Field2, Field3, Field4)</span> |
---|
110 | 0016 <span class="comment">%</span> |
---|
111 | 0017 <span class="comment">% INPUTS</span> |
---|
112 | 0018 <span class="comment">% 1. Family = Family Name</span> |
---|
113 | 0019 <span class="comment">% Data Structure (only the FamilyName is used)</span> |
---|
114 | 0020 <span class="comment">% Field</span> |
---|
115 | 0021 <span class="comment">% Accelerator Object</span> |
---|
116 | 0022 <span class="comment">% 2. Field1 = Field name (string)</span> |
---|
117 | 0023 <span class="comment">% 3. Field2 = Field name (string)</span> |
---|
118 | 0024 <span class="comment">% 4. DeviceList = Device list for that family</span> |
---|
119 | 0025 <span class="comment">%</span> |
---|
120 | 0026 <span class="comment">% OUTPUT</span> |
---|
121 | 0027 <span class="comment">% 1. Data = AO.Field1.Field2 or AD.Field1.Field2.Field3.Field4</span> |
---|
122 | 0028 <span class="comment">% Looks for Family in the accelerator data structure and returns the appropriate data.</span> |
---|
123 | 0029 <span class="comment">%</span> |
---|
124 | 0030 <span class="comment">% If DeviceList is not an input, then the exact contents of the field is returned</span> |
---|
125 | 0031 <span class="comment">% If DeviceList exists, then Data is indexed according to DeviceList</span> |
---|
126 | 0032 <span class="comment">% If DeviceList is empty, [], then the entire DeviceList is returned</span> |
---|
127 | 0033 <span class="comment">% If DeviceList is empty, [], and the field is one row (or cell) then Data is expanded</span> |
---|
128 | 0034 <span class="comment">% to the size of the entire DeviceList</span> |
---|
129 | 0035 <span class="comment">%</span> |
---|
130 | 0036 <span class="comment">% Returns [] if the data could not be found</span> |
---|
131 | 0037 <span class="comment">%</span> |
---|
132 | 0038 <span class="comment">% 2. ErrorFlag = 1 if the data could not be found</span> |
---|
133 | 0039 <span class="comment">%</span> |
---|
134 | 0040 <span class="comment">% NOTE</span> |
---|
135 | 0041 <span class="comment">% 1. If the inputs are cell arrays, then the output is a cell array</span> |
---|
136 | 0042 <span class="comment">% 2. If Family is a cell array, then DeviceList must also be a cell array,</span> |
---|
137 | 0043 <span class="comment">% however, Field1 or Field2 can either be a cell array array or a string.</span> |
---|
138 | 0044 <span class="comment">%</span> |
---|
139 | 0045 <span class="comment">% EXAMPLES</span> |
---|
140 | 0046 <span class="comment">% 1. getfamilydata('BPMx')</span> |
---|
141 | 0047 <span class="comment">% 2. getfamilydata('BPMx','Monitor')</span> |
---|
142 | 0048 <span class="comment">% 3. getfamilydata('BPMx','Monitor','Units')</span> |
---|
143 | 0049 <span class="comment">% 4. getfamilydata('HCOR', 'Status')</span> |
---|
144 | 0050 <span class="comment">%</span> |
---|
145 | 0051 <span class="comment">% See Also setfamilydata</span> |
---|
146 | 0052 |
---|
147 | 0053 <span class="comment">%</span> |
---|
148 | 0054 <span class="comment">% Written by Gregory J. Portmann</span> |
---|
149 | 0055 <span class="comment">% Modified by Laurent S. Nadolski</span> |
---|
150 | 0056 |
---|
151 | 0057 <span class="keyword">if</span> nargin == 0 |
---|
152 | 0058 Data = getappdata(0, <span class="string">'AcceleratorObjects'</span>); |
---|
153 | 0059 <span class="keyword">return</span> |
---|
154 | 0060 <span class="keyword">end</span> |
---|
155 | 0061 |
---|
156 | 0062 <span class="comment">% Cell array input</span> |
---|
157 | 0063 <span class="keyword">if</span> iscell(Family) |
---|
158 | 0064 <span class="keyword">if</span> nargin >= 2 |
---|
159 | 0065 <span class="keyword">if</span> iscell(Field1) |
---|
160 | 0066 <span class="keyword">if</span> length(Family) ~= length(Field1) |
---|
161 | 0067 error(<span class="string">'If Field1 is a cell array, then it must be the same size as Family.'</span>); |
---|
162 | 0068 <span class="keyword">end</span> |
---|
163 | 0069 <span class="keyword">end</span> |
---|
164 | 0070 <span class="keyword">end</span> |
---|
165 | 0071 <span class="keyword">if</span> nargin >= 3 |
---|
166 | 0072 <span class="keyword">if</span> iscell(Field2) |
---|
167 | 0073 <span class="keyword">if</span> length(Family) ~= length(Field2) |
---|
168 | 0074 error(<span class="string">'If Field2 is a cell array, then it must be the same size as Family.'</span>); |
---|
169 | 0075 <span class="keyword">end</span> |
---|
170 | 0076 <span class="keyword">end</span> |
---|
171 | 0077 <span class="keyword">end</span> |
---|
172 | 0078 <span class="keyword">if</span> nargin >= 4 |
---|
173 | 0079 <span class="keyword">if</span> ~iscell(DeviceList) |
---|
174 | 0080 error(<span class="string">'If family is a cell array, then DeviceList must be a cell array.'</span>); |
---|
175 | 0081 <span class="keyword">end</span> |
---|
176 | 0082 <span class="keyword">if</span> length(Family) ~= length(DeviceList) |
---|
177 | 0083 error(<span class="string">'Family and DeviceList must be the same size cell arrays.'</span>); |
---|
178 | 0084 <span class="keyword">end</span> |
---|
179 | 0085 <span class="keyword">end</span> |
---|
180 | 0086 |
---|
181 | 0087 <span class="keyword">for</span> i = 1:length(Family) |
---|
182 | 0088 <span class="keyword">if</span> nargin == 1 |
---|
183 | 0089 [Data{i}, ErrorFlag{i}] = <a href="getfamilydata.html" class="code" title="function [Data, ErrorFlag] = getfamilydata(Family, Field1, Field2, DeviceList)">getfamilydata</a>(Family{i}); |
---|
184 | 0090 <span class="keyword">elseif</span> nargin == 2 |
---|
185 | 0091 <span class="keyword">if</span> iscell(Field1) |
---|
186 | 0092 [Data{i}, ErrorFlag{i}] = <a href="getfamilydata.html" class="code" title="function [Data, ErrorFlag] = getfamilydata(Family, Field1, Field2, DeviceList)">getfamilydata</a>(Family{i}, Field1{i}); |
---|
187 | 0093 <span class="keyword">else</span> |
---|
188 | 0094 [Data{i}, ErrorFlag{i}] = <a href="getfamilydata.html" class="code" title="function [Data, ErrorFlag] = getfamilydata(Family, Field1, Field2, DeviceList)">getfamilydata</a>(Family{i}, Field1); |
---|
189 | 0095 <span class="keyword">end</span> |
---|
190 | 0096 <span class="keyword">elseif</span> nargin == 3 |
---|
191 | 0097 <span class="keyword">if</span> iscell(Field1) |
---|
192 | 0098 <span class="keyword">if</span> iscell(Field2) |
---|
193 | 0099 [Data{i}, ErrorFlag{i}] = <a href="getfamilydata.html" class="code" title="function [Data, ErrorFlag] = getfamilydata(Family, Field1, Field2, DeviceList)">getfamilydata</a>(Family{i}, Field1{i}, Field2{i}); |
---|
194 | 0100 <span class="keyword">else</span> |
---|
195 | 0101 [Data{i}, ErrorFlag{i}] = <a href="getfamilydata.html" class="code" title="function [Data, ErrorFlag] = getfamilydata(Family, Field1, Field2, DeviceList)">getfamilydata</a>(Family{i}, Field1{i}, Field2); |
---|
196 | 0102 <span class="keyword">end</span> |
---|
197 | 0103 <span class="keyword">else</span> |
---|
198 | 0104 <span class="keyword">if</span> iscell(Field2) |
---|
199 | 0105 [Data{i}, ErrorFlag{i}] = <a href="getfamilydata.html" class="code" title="function [Data, ErrorFlag] = getfamilydata(Family, Field1, Field2, DeviceList)">getfamilydata</a>(Family{i}, Field1, Field2{i}); |
---|
200 | 0106 <span class="keyword">else</span> |
---|
201 | 0107 [Data{i}, ErrorFlag{i}] = <a href="getfamilydata.html" class="code" title="function [Data, ErrorFlag] = getfamilydata(Family, Field1, Field2, DeviceList)">getfamilydata</a>(Family{i}, Field1, Field2); |
---|
202 | 0108 <span class="keyword">end</span> |
---|
203 | 0109 <span class="keyword">end</span> |
---|
204 | 0110 <span class="keyword">else</span> |
---|
205 | 0111 <span class="keyword">if</span> iscell(Field1) |
---|
206 | 0112 <span class="keyword">if</span> iscell(Field2) |
---|
207 | 0113 [Data{i}, ErrorFlag{i}] = <a href="getfamilydata.html" class="code" title="function [Data, ErrorFlag] = getfamilydata(Family, Field1, Field2, DeviceList)">getfamilydata</a>(Family{i}, Field1{i}, Field2{i}, DeviceList{i}); |
---|
208 | 0114 <span class="keyword">else</span> |
---|
209 | 0115 [Data{i}, ErrorFlag{i}] = <a href="getfamilydata.html" class="code" title="function [Data, ErrorFlag] = getfamilydata(Family, Field1, Field2, DeviceList)">getfamilydata</a>(Family{i}, Field1{i}, Field2, DeviceList{i}); |
---|
210 | 0116 <span class="keyword">end</span> |
---|
211 | 0117 <span class="keyword">else</span> |
---|
212 | 0118 <span class="keyword">if</span> iscell(Field2) |
---|
213 | 0119 [Data{i}, ErrorFlag{i}] = <a href="getfamilydata.html" class="code" title="function [Data, ErrorFlag] = getfamilydata(Family, Field1, Field2, DeviceList)">getfamilydata</a>(Family{i}, Field1, Field2{i}, DeviceList{i}); |
---|
214 | 0120 <span class="keyword">else</span> |
---|
215 | 0121 [Data{i}, ErrorFlag{i}] = <a href="getfamilydata.html" class="code" title="function [Data, ErrorFlag] = getfamilydata(Family, Field1, Field2, DeviceList)">getfamilydata</a>(Family{i}, Field1, Field2, DeviceList{i}); |
---|
216 | 0122 <span class="keyword">end</span> |
---|
217 | 0123 <span class="keyword">end</span> |
---|
218 | 0124 <span class="keyword">end</span> |
---|
219 | 0125 <span class="keyword">end</span> |
---|
220 | 0126 <span class="keyword">return</span> |
---|
221 | 0127 <span class="keyword">end</span> <span class="comment">% End cell inputs</span> |
---|
222 | 0128 |
---|
223 | 0129 |
---|
224 | 0130 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%%%%%</span> |
---|
225 | 0131 <span class="comment">% Non-cell getfamilydata %</span> |
---|
226 | 0132 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%%%%%</span> |
---|
227 | 0133 ErrorFlag = 0; |
---|
228 | 0134 |
---|
229 | 0135 [FamilyIndex, AO] = <a href="isfamily.html" class="code" title="function [FamilyFlag, AO] = isfamily(Family, Field)">isfamily</a>(Family); |
---|
230 | 0136 <span class="keyword">if</span> FamilyIndex |
---|
231 | 0137 <span class="keyword">if</span> nargin == 1 |
---|
232 | 0138 Data = AO; |
---|
233 | 0139 <span class="keyword">return</span> |
---|
234 | 0140 <span class="keyword">end</span> |
---|
235 | 0141 <span class="keyword">else</span> |
---|
236 | 0142 <span class="comment">% Check the AD</span> |
---|
237 | 0143 AD = <a href="getad.html" class="code" title="function AD = getad">getad</a>; |
---|
238 | 0144 <span class="keyword">if</span> isfield(AD, Family) |
---|
239 | 0145 Data = AD.(Family); |
---|
240 | 0146 <span class="keyword">else</span> |
---|
241 | 0147 Data = []; |
---|
242 | 0148 ErrorFlag = 1; |
---|
243 | 0149 <span class="keyword">return</span> |
---|
244 | 0150 <span class="keyword">end</span> |
---|
245 | 0151 <span class="keyword">if</span> nargin > 1 |
---|
246 | 0152 <span class="keyword">if</span> isfield(Data, Field1) |
---|
247 | 0153 Data = Data.(Field1); |
---|
248 | 0154 <span class="keyword">else</span> |
---|
249 | 0155 Data = []; |
---|
250 | 0156 ErrorFlag = 1; |
---|
251 | 0157 <span class="keyword">end</span> |
---|
252 | 0158 <span class="keyword">end</span> |
---|
253 | 0159 <span class="keyword">if</span> nargin > 2 |
---|
254 | 0160 <span class="keyword">if</span> isfield(Data, Field2) |
---|
255 | 0161 Data = Data.(Field2); |
---|
256 | 0162 <span class="keyword">else</span> |
---|
257 | 0163 Data = []; |
---|
258 | 0164 ErrorFlag = 1; |
---|
259 | 0165 <span class="keyword">end</span> |
---|
260 | 0166 <span class="keyword">end</span> |
---|
261 | 0167 <span class="keyword">return</span> |
---|
262 | 0168 <span class="keyword">end</span> |
---|
263 | 0169 |
---|
264 | 0170 |
---|
265 | 0171 <span class="comment">% Select field1</span> |
---|
266 | 0172 <span class="keyword">if</span> isfield(AO, Field1) |
---|
267 | 0173 Data = AO.(Field1); |
---|
268 | 0174 <span class="keyword">else</span> |
---|
269 | 0175 Data = []; |
---|
270 | 0176 ErrorFlag = 1; |
---|
271 | 0177 <span class="keyword">return</span> |
---|
272 | 0178 <span class="keyword">end</span> |
---|
273 | 0179 <span class="keyword">if</span> nargin == 2 |
---|
274 | 0180 <span class="keyword">return</span> |
---|
275 | 0181 <span class="keyword">end</span> |
---|
276 | 0182 |
---|
277 | 0183 <span class="comment">% Select field2 or field2 maybe a devicelist</span> |
---|
278 | 0184 <span class="keyword">if</span> nargin == 3 |
---|
279 | 0185 <span class="keyword">if</span> isstr(Field2) |
---|
280 | 0186 <span class="keyword">if</span> isfield(Data, Field2) |
---|
281 | 0187 Data = Data.(Field2); |
---|
282 | 0188 <span class="keyword">else</span> |
---|
283 | 0189 Data = []; |
---|
284 | 0190 ErrorFlag = 1; |
---|
285 | 0191 <span class="keyword">end</span> |
---|
286 | 0192 <span class="keyword">return</span> |
---|
287 | 0193 <span class="keyword">else</span> |
---|
288 | 0194 DeviceList = Field2; |
---|
289 | 0195 <span class="keyword">end</span> |
---|
290 | 0196 <span class="keyword">end</span> |
---|
291 | 0197 |
---|
292 | 0198 <span class="comment">% Select field2</span> |
---|
293 | 0199 <span class="keyword">if</span> nargin >= 4 |
---|
294 | 0200 <span class="keyword">if</span> isfield(Data, Field2) |
---|
295 | 0201 Data = Data.(Field2); |
---|
296 | 0202 <span class="keyword">else</span> |
---|
297 | 0203 Data = []; |
---|
298 | 0204 ErrorFlag = 1; |
---|
299 | 0205 <span class="keyword">return</span> |
---|
300 | 0206 <span class="keyword">end</span> |
---|
301 | 0207 <span class="keyword">end</span> |
---|
302 | 0208 |
---|
303 | 0209 |
---|
304 | 0210 <span class="comment">% If you made it to here, DeviceList must exist</span> |
---|
305 | 0211 <span class="keyword">if</span> isempty(DeviceList) |
---|
306 | 0212 DeviceList = <a href="family2dev.html" class="code" title="function DeviceList = family2dev(Family, varargin);">family2dev</a>(Family); |
---|
307 | 0213 <span class="keyword">end</span> |
---|
308 | 0214 <span class="keyword">if</span> (size(DeviceList,2) == 1) <span class="comment">%Elementlist</span> |
---|
309 | 0215 DeviceList = <a href="elem2dev.html" class="code" title="function Output = elem2dev(Family, ElementList)">elem2dev</a>(Family, DeviceList); |
---|
310 | 0216 <span class="keyword">end</span> |
---|
311 | 0217 |
---|
312 | 0218 DeviceListTotal = AO.DeviceList; |
---|
313 | 0219 <span class="comment">%DeviceListTotal = family2dev(Family, 0);</span> |
---|
314 | 0220 |
---|
315 | 0221 <span class="keyword">if</span> iscell(Data) |
---|
316 | 0222 <span class="keyword">if</span> size(Data,1) == 1 |
---|
317 | 0223 <span class="comment">% For each cell array determine what rows needs to be altered</span> |
---|
318 | 0224 <span class="keyword">for</span> i = 1:size(Data,2) |
---|
319 | 0225 Data{i} = <a href="#_sub1" class="code" title="subfunction Data = sortdatabydevicelist(Data, DeviceList, DeviceListTotal)">sortdatabydevicelist</a>(Data{i}, DeviceList, DeviceListTotal); |
---|
320 | 0226 <span class="keyword">end</span> |
---|
321 | 0227 <span class="keyword">return</span> |
---|
322 | 0228 <span class="keyword">elseif</span> size(Data,1) == size(DeviceListTotal,1) |
---|
323 | 0229 <span class="comment">% Cell matrix is Ok (but not recommended)</span> |
---|
324 | 0230 <span class="keyword">else</span> |
---|
325 | 0231 error(sprintf(<span class="string">'Number of rows in AO field must be 1 or equal to the number of rows in AO{}.DeviceList.'</span>)); |
---|
326 | 0232 <span class="keyword">end</span> |
---|
327 | 0233 <span class="keyword">elseif</span> isstruct(Data) |
---|
328 | 0234 error(<span class="string">'Structure AO fields can not be indexed by a DeviceList.'</span>); |
---|
329 | 0235 <span class="keyword">end</span> |
---|
330 | 0236 |
---|
331 | 0237 Data = <a href="#_sub1" class="code" title="subfunction Data = sortdatabydevicelist(Data, DeviceList, DeviceListTotal)">sortdatabydevicelist</a>(Data, DeviceList, DeviceListTotal); |
---|
332 | 0238 |
---|
333 | 0239 <span class="comment">%%----------------------------------------------------------------------</span> |
---|
334 | 0240 <a name="_sub1" href="#_subfunctions" class="code">function Data = sortdatabydevicelist(Data, DeviceList, DeviceListTotal)</a> |
---|
335 | 0241 |
---|
336 | 0242 <span class="comment">% Data should be equal to the number of row in DeviceListTotal or be one row</span> |
---|
337 | 0243 <span class="keyword">if</span> size(DeviceListTotal,1) ~= size(Data,1) |
---|
338 | 0244 <span class="keyword">if</span> size(Data,1) == 1 |
---|
339 | 0245 <span class="comment">% All the rows of output data will be the same</span> |
---|
340 | 0246 <span class="keyword">if</span> iscell(Data) |
---|
341 | 0247 <span class="comment">% This will make a cell matrix which we decided not a allow</span> |
---|
342 | 0248 fprintf(<span class="string">' When using a 1 row cell array, Instead of using a cell matrix, use a cell row.\n'</span>) |
---|
343 | 0249 error(<span class="string">'Cell matrix error'</span>) |
---|
344 | 0250 |
---|
345 | 0251 <span class="comment">% Repeat the 1 row Data cell array as many times as in the rows of DeviceListTotal</span> |
---|
346 | 0252 Data1 = Data; |
---|
347 | 0253 Data = cell(size(DeviceList,1), size(Data1,2)); |
---|
348 | 0254 <span class="keyword">for</span> i = 1:size(Data1,2) |
---|
349 | 0255 Data(:,i) = Data1(1,i); |
---|
350 | 0256 <span class="keyword">end</span> |
---|
351 | 0257 |
---|
352 | 0258 <span class="keyword">elseif</span> isstr(Data) |
---|
353 | 0259 <span class="comment">% Repeat the one row string as many times as in the rows of DeviceListTotal</span> |
---|
354 | 0260 DataStr = Data; |
---|
355 | 0261 Data = []; |
---|
356 | 0262 <span class="keyword">for</span> i = 1:size(DeviceList,1) |
---|
357 | 0263 Data = [Data; DataStr]; |
---|
358 | 0264 <span class="keyword">end</span> |
---|
359 | 0265 |
---|
360 | 0266 <span class="keyword">else</span> |
---|
361 | 0267 <span class="comment">% Repeat the one row Data vector as many times as in the rows of DeviceListTotal</span> |
---|
362 | 0268 Data = ones(size(DeviceList,1),1) * Data; |
---|
363 | 0269 <span class="keyword">end</span> |
---|
364 | 0270 <span class="keyword">else</span> |
---|
365 | 0271 error(sprintf(<span class="string">'Number of rows in AO field must be 1 or equal to the number of rows in AO{}.DeviceList.'</span>)); |
---|
366 | 0272 <span class="keyword">end</span> |
---|
367 | 0273 <span class="keyword">return</span> |
---|
368 | 0274 <span class="keyword">end</span> |
---|
369 | 0275 |
---|
370 | 0276 |
---|
371 | 0277 [DeviceIndex, iNotFound] = findrowindex(DeviceList, DeviceListTotal); |
---|
372 | 0278 <span class="keyword">if</span> ~isempty(iNotFound) |
---|
373 | 0279 ErrorFlag = 1; |
---|
374 | 0280 <span class="keyword">for</span> i = 1:length(iNotFound) |
---|
375 | 0281 fprintf(<span class="string">' Can''t find (%d,%d) device in DeviceList.\n'</span>, DeviceList(iNotFound(i),1), DeviceList(iNotFound(i),2)); |
---|
376 | 0282 <span class="keyword">end</span> |
---|
377 | 0283 error(sprintf(<span class="string">'%d Devices not found'</span>, length(iNotFound))); |
---|
378 | 0284 <span class="keyword">end</span> |
---|
379 | 0285 Data = Data(DeviceIndex,:); |
---|
380 | 0286 |
---|
381 | 0287 <span class="comment">% % Intersect removes duplicate devices so first store index of how to unsort in j_unique</span> |
---|
382 | 0288 <span class="comment">% DeviceListOld = DeviceList;</span> |
---|
383 | 0289 <span class="comment">% [DeviceList, i_unique, j_unique] = unique(DeviceList, 'rows');</span> |
---|
384 | 0290 <span class="comment">%</span> |
---|
385 | 0291 <span class="comment">% % Find the indexes in the full device list (reorder and remove duplicates)</span> |
---|
386 | 0292 <span class="comment">% [DeviceList, ii, DeviceIndex] = intersect(DeviceList, DeviceListTotal, 'rows');</span> |
---|
387 | 0293 <span class="comment">% if size(DeviceList,1) ~= size(DeviceListOld,1)</span> |
---|
388 | 0294 <span class="comment">% % All devices must exist (duplicate devices ok)</span> |
---|
389 | 0295 <span class="comment">% [DeviceListNotFound, iNotFound] = setdiff(DeviceListOld, DeviceListTotal, 'rows');</span> |
---|
390 | 0296 <span class="comment">% if length(iNotFound) > 0</span> |
---|
391 | 0297 <span class="comment">% % Device not found</span> |
---|
392 | 0298 <span class="comment">% for i = 1:length(iNotFound)</span> |
---|
393 | 0299 <span class="comment">% fprintf(' No devices to get for Family %s(%d,%d)\n', AO.FamilyName, DeviceListNotFound(i,1), DeviceListNotFound(i,2));</span> |
---|
394 | 0300 <span class="comment">% end</span> |
---|
395 | 0301 <span class="comment">% error(sprintf('%d Devices not found', length(iNotFound)));</span> |
---|
396 | 0302 <span class="comment">% end</span> |
---|
397 | 0303 <span class="comment">% end</span> |
---|
398 | 0304 <span class="comment">%</span> |
---|
399 | 0305 <span class="comment">% % DataType='vector' only has one FamilyName and handle for a multiple element DeviceList</span> |
---|
400 | 0306 <span class="comment">% % Hence, Data could have one row for a many rowed DeviceList. To deal with this only index</span> |
---|
401 | 0307 <span class="comment">% % by DeviceIndex if Data has more than one row.</span> |
---|
402 | 0308 <span class="comment">% if size(Data,1) > 1</span> |
---|
403 | 0309 <span class="comment">% Data = Data(DeviceIndex,:); % Only data referenced to DeviceList</span> |
---|
404 | 0310 <span class="comment">% Data = Data(j_unique,:); % Reorder and add multiple elements back</span> |
---|
405 | 0311 <span class="comment">% end</span></pre></div> |
---|
406 | <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> © 2003</address> |
---|
407 | </body> |
---|
408 | </html> |
---|