source: MML/trunk/mml/showfamily.m @ 4

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

Initial import--MML version from SOLEIL@2013

File size: 2.5 KB
Line 
1function  AO = showfamily(Family)
2%SHOWFAMILY - Displays a list of all families
3%  AO = showfamily(Family)
4%
5%  INPUTS
6%  1. Family -  Family name {Default: All families}
7
8%  OUTPUTS
9%  1. AO - Structure for that family or the entire AO for no inputs
10%
11%  See also getfamilylist, showfamily, isfamily, getfamilytype
12
13%
14%  Written by J. Corbett
15% Modified by Laurent S. Nadolski
16% ChannelNames --> TangoNames
17
18if nargin < 1
19    AO = getao;
20    FieldNameCell = fieldnames(AO);
21    Ntotal = 0;
22   
23    for i = 1:length(FieldNameCell)
24        if isfield(AO, FieldNameCell{i})
25            if isfield(AO.(FieldNameCell{i}),'FamilyName')
26                N = size(AO.(FieldNameCell{i}).DeviceList,1);
27                fprintf('   Family = %s (%d devices)\n', AO.(FieldNameCell{i}).FamilyName,  N);
28            else
29                N = 0;
30            end
31           
32            % Find all the subfields that are data structures
33            SubFieldNameCell = fieldnames(AO.(FieldNameCell{i}));
34            NDeviceFamily = 0;
35            for ii = 1:length(SubFieldNameCell)
36                if isfield(AO.(FieldNameCell{i}).(SubFieldNameCell{ii}),'TangoNames')  ...
37                | isfield(AO.(FieldNameCell{i}).(SubFieldNameCell{ii}),'SpecialFunction')  ...
38                | isfield(AO.(FieldNameCell{i}).(SubFieldNameCell{ii}),'SpecialFunctionGet')  ...
39                | isfield(AO.(FieldNameCell{i}).(SubFieldNameCell{ii}),'SpecialFunctionSet')
40                   
41                    fprintf('   %s.%s\n', AO.(FieldNameCell{i}).FamilyName, SubFieldNameCell{ii});
42                    NDeviceFamily = NDeviceFamily + N;
43                    Ntotal = Ntotal + N;
44                end
45            end
46            fprintf('\n');
47        end
48    end
49    fprintf('   The total number of devices is %d\n', Ntotal);
50   
51else
52   
53    [Flag, AO] = isfamily(Family);
54   
55    if ~Flag 
56        disp('Warning: Family not found in showfamily');
57        return;
58    end
59   
60    fields = fieldnames(AO);
61   
62    disp('   =============================================');
63    fprintf('   Fields contained in Family:  %s (%d devices)\n', AO.FamilyName,  size(AO.DeviceList,1));
64    disp('   =============================================');
65    for ii=1:length(fields)
66        disp(['   ', fields{ii}])
67        if isstruct(AO.(fields{ii}))                      %dynamic field names
68            subfields=fieldnames(AO.(fields{ii}));
69            for jj=1:length(subfields)
70                disp(['      ' subfields{jj}])
71            end
72        end
73    end
74    fprintf('\n');
75   
76end
Note: See TracBrowser for help on using the repository browser.