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 | |
---|
1 | function [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 | |
---|
17 | if nargin == 0, |
---|
18 | error('Must have at least one input (ATIndex).'); |
---|
19 | end |
---|
20 | |
---|
21 | if isempty(ATIndex) |
---|
22 | Family = ''; |
---|
23 | DeviceList = []; |
---|
24 | ErrorFlag = -1; |
---|
25 | return; |
---|
26 | end |
---|
27 | |
---|
28 | |
---|
29 | Families = getfamilylist; |
---|
30 | FamilyCell = {}; |
---|
31 | DeviceListCell = {}; |
---|
32 | iHit = []; |
---|
33 | for 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 |
---|
49 | end |
---|
50 | |
---|
51 | if isempty(FamilyCell) |
---|
52 | Family = ''; |
---|
53 | DeviceList = []; |
---|
54 | ErrorFlag = -1; |
---|
55 | else |
---|
56 | Family = FamilyCell{1}; |
---|
57 | DeviceList = DeviceListCell{1}; |
---|
58 | ErrorFlag = 0; |
---|
59 | end |
---|
60 | |
---|
Note: See
TracBrowser
for help on using the repository browser.