0001 function S = getmaxsp(Family, DeviceList)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039 S = [];
0040
0041 if nargin == 0
0042 error('At least one input required');
0043 end
0044
0045 if iscell(Family)
0046 if nargin >= 2
0047 if ~iscell(DeviceList)
0048 error('If Family is a cell array, then DeviceList must be a cell array.');
0049 end
0050 if length(Family) ~= length(DeviceList)
0051 error('Family and DeviceList must be the same size cell arrays.');
0052 end
0053 end
0054
0055 for i = 1:length(Family)
0056 if nargin == 1
0057 S{i} = getmaxsp(Family{i});
0058 else
0059 S{i} = getmaxsp(Family{i}, DeviceList{i});
0060 end
0061 end
0062 return
0063 end
0064
0065 if isstruct(Family)
0066 if any(size(Family) > 1)
0067 error('Only structures of size = [1 1] allowed')
0068 end
0069 if isfield(Family,'FamilyName') & isfield(Family,'Field')
0070
0071 S = getfamilydata(Family.FamilyName, Family.Field, 'Range', Family.DeviceList);
0072 if ~isempty(S)
0073 S = S(:,2);
0074 end
0075 return
0076 else
0077
0078 if nargin < 2
0079 S = Family.Setpoint.Range;
0080 else
0081 if size(DeviceList,2) == 1
0082 Index = findrowindex(DeviceList, ElementList);
0083 else
0084 Index = findrowindex(DeviceList, Family.DeviceList);
0085 end
0086 S = Family.Setpoint.Range(Index,2);
0087 end
0088 end
0089 end
0090
0091
0092 if isempty(Family)
0093
0094 if nargin < 2
0095 error('If Family=[], 2 inputs are required.');
0096 end
0097 CommonNames = DeviceList;
0098 for i = 1:size(CommonNames,1)
0099 Family = common2family(CommonNames(i,:));
0100 [FamilyIndex, ACCELERATOR_OBJECT] = isfamily(Family);
0101 DeviceList = common2dev(CommonNames(i,:), ACCELERATOR_OBJECT);
0102 if isempty(DeviceList) | isempty(DeviceList)
0103 error('Common name could not be converted to a Family and DeviceList.');
0104 end
0105 S(i,:) = getmaxsp(Family, DeviceList);
0106 end
0107 return
0108
0109 elseif ~isfamily(Family(1,:))
0110
0111
0112
0113 ChannelNames = Family;
0114 for i = 1:size(ChannelNames,1)
0115 Family = channel2family(ChannelNames(i,:));
0116 [FamilyIndex, ACCELERATOR_OBJECT] = isfamily(Family);
0117 DeviceList = channel2dev(ChannelNames(i,:), ACCELERATOR_OBJECT);
0118 if isempty(DeviceList) | isempty(DeviceList)
0119 error('Channel name could not be converted to a Family and DeviceList.');
0120 end
0121 S(i,:) = getmaxsp(Family, DeviceList);
0122 end
0123 return
0124 end
0125
0126
0127 if nargin == 1
0128 S = getfamilydata(Family, 'Setpoint', 'Range', []);
0129 else
0130
0131 if isstr(DeviceList)
0132 DeviceList = common2dev(DeviceList, Family);
0133 end
0134 S = getfamilydata(Family, 'Setpoint', 'Range', DeviceList);
0135 end
0136 if ~isempty(S)
0137 S = S(:,2);
0138 end