source: MML/trunk/mml/at/atindex2family.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.4 KB
Line 
1function [Family, DeviceList, FamilyCell, DeviceListCell, ErrorFlag] = atindex2family(ATIndex, varargin);
2%ATINDEX2FAMILY - Returns the AT index for a given family
3%  [Family, DeviceList] = atindex2family(ATIndex)
4%
5%  INPUTS
6%  1. ATIndexList - AT indexes referenced to THERING
7%
8%  OUTPUTS
9%  1. Family - Family Name (first match found)
10%  2. DeviceList - Device list (first match found)
11%  3. FamilyCell - Family name cell array of all AT index matches
12%  4. DeviceListCell - Device list cell array of all AT index matches
13%
14%  Written by Greg Portmann
15
16
17if nargin == 0,
18    error('Must have at least one input (ATIndex).');
19end
20
21if isempty(ATIndex)
22    Family = '';
23    DeviceList = [];
24    ErrorFlag = -1;
25    return;
26end
27
28
29Families = getfamilylist;
30FamilyCell = {};
31DeviceListCell = {};
32iHit = [];
33for i = 1:size(Families,1)
34    Family = deblank(Families(i,:));
35    DeviceList = family2dev(Family, 0);
36    try
37        [ATIndexList, ErrorFlag] = family2atindex(Family, DeviceList);
38       
39        [iHit, Col] = find(ATIndex == ATIndexList);
40        if ~isempty(iHit)
41            FamilyCell = [FamilyCell;{Family}];
42            DeviceListCell = [DeviceListCell; {DeviceList(iHit,:)}];
43            if nargout < 3
44                break;
45            end
46        end
47    catch
48    end
49end
50
51if isempty(FamilyCell)
52    Family = '';
53    DeviceList = [];
54    ErrorFlag = -1;
55else
56    Family = FamilyCell{1};
57    DeviceList = DeviceListCell{1};
58    ErrorFlag = 0;
59end
60
Note: See TracBrowser for help on using the repository browser.