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 [GroupId, ErrorFlag] = family2tangogroup(Family) |
---|
2 | %FAMILY2TANGOGROUP - Return TANGO group family |
---|
3 | % [GroupId, ErrorFlag] = family2tangogroup(Family, Field, DeviceList) |
---|
4 | % |
---|
5 | % INPUTS |
---|
6 | % 1. Family = Family Name |
---|
7 | % Data Structure |
---|
8 | % Accelerator Object |
---|
9 | % Cell Array |
---|
10 | % |
---|
11 | % OUTPUTS |
---|
12 | % 1. GroupId = Tango Group ID if defined, NaN otherwise |
---|
13 | % |
---|
14 | % See also family2tango, tango2family |
---|
15 | |
---|
16 | % |
---|
17 | % Written by Laurent S. Nadolski |
---|
18 | |
---|
19 | |
---|
20 | if nargin == 0 |
---|
21 | error('Must have at least one input (''Family'')!'); |
---|
22 | end |
---|
23 | |
---|
24 | if isstruct(Family) |
---|
25 | if isfield(Family,'FamilyName') |
---|
26 | % For data structures (as returned by getpv) |
---|
27 | InputStruct = Family; |
---|
28 | if isfield(InputStruct,'FamilyName') |
---|
29 | % Data structure |
---|
30 | Family = InputStruct.FamilyName; |
---|
31 | else |
---|
32 | error('Family input of unknown type'); |
---|
33 | end |
---|
34 | end |
---|
35 | end |
---|
36 | |
---|
37 | if iscell(Family) |
---|
38 | for i = 1:length(Family), |
---|
39 | [GroupId{i}, ErrorFlag{i}] = family2tangogroup(Family{i}); |
---|
40 | end |
---|
41 | return |
---|
42 | end |
---|
43 | |
---|
44 | % Check number of argment |
---|
45 | if nargin <1 |
---|
46 | error('Must have at least one input (''Family'')!'); |
---|
47 | end |
---|
48 | |
---|
49 | % If valid familyname |
---|
50 | if isfamily(Family) |
---|
51 | ErrorFlag = 0; |
---|
52 | GroupId = getfamilydata(Family,'GroupId'); |
---|
53 | |
---|
54 | % if no group defined |
---|
55 | if isempty(GroupId) |
---|
56 | ErrorFlag = 1; |
---|
57 | GroupId = NaN; |
---|
58 | end |
---|
59 | else % if not a valid family |
---|
60 | ErrorFlag = 1; |
---|
61 | GroupId = NaN; |
---|
62 | end |
---|
Note: See
TracBrowser
for help on using the repository browser.