source: MML/trunk/mml/at/family2atindex.m @ 4

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

Initial import--MML version from SOLEIL@2013

File size: 1.5 KB
Line 
1function [ATIndexList, ErrorFlag] = family2atindex(Family, varargin);
2%FAMILY2ATINDEX - Returns the AT index for a given family
3%  ATIndexList = family2atindex(Family, DeviceList)
4%
5%  INPUTS
6%  1. Family - Family Name
7%              Accelerator Object
8%              Cell Array of Accelerator Objects or Family Names
9%              AT FamName (or 'All' every AT index)
10%  2. DeviceList - Device list {Default: the entire family (familydev('Family',0))}
11%
12%  OUTPUTS
13%  1. ATIndexList - List of AT indexes referenced to THERING
14%                   If the family a split magnet, then muliply columns will be output
15%
16%  NOTES
17%  1. If Family is a cell array, then DeviceList must also be a cell array
18%  2. If using AT FamName, then DeviceList is index vector, ie,
19%              Length = THERING{ATIndexList}.Length(DeviceList)
20%
21%  Written by Greg Portmann
22
23ErrorFlag = 0;
24
25if nargin == 0,
26    error('Must have at least one input (Family or Channel Name).');
27end
28
29
30[ATIndexList, ErrorFlag] = getfamilydata(Family, 'AT', 'ATIndex', varargin{:});
31
32if isempty(ATIndexList)
33    % Try an AT family
34    global THERING
35   
36    if strcmpi(Family, 'All')
37        ATIndexList = (1:length(THERING))';
38    else
39        ATIndexList = findcells(THERING, 'FamName', Family);
40        ATIndexList = ATIndexList(:);
41    end
42   
43    if nargin >= 2
44        if ~isempty(varargin{1})
45            if size(varargin{1},2) == 2
46                varargin{1} = varargin{1}(:,2);
47            end
48        end
49        ATIndexList = ATIndexList(varargin{1});
50    end
51end
52
Note: See TracBrowser for help on using the repository browser.