SORTCORS - Compares vectors for several cases: (1) available electronically (COR.status) (2) available in response matrix (RSP.ic) (3) check for user selection (COR.ifit) INPUTS 1. Corrector structure 2. Response matrix structure OUTPUTS 1. Updated Corrector structure
0001 function varargout = sortcors(varargin) 0002 %SORTCORS - Compares vectors for several cases: 0003 %(1) available electronically (COR.status) 0004 %(2) available in response matrix (RSP.ic) 0005 %(3) check for user selection (COR.ifit) 0006 % 0007 % INPUTS 0008 % 1. Corrector structure 0009 % 2. Response matrix structure 0010 % 0011 % OUTPUTS 0012 % 1. Updated Corrector structure 0013 0014 % 0015 % Written by William J. Corbett 0016 % Modified by Laurent S. Nadolski 0017 0018 COR = varargin{1}; 0019 RSP = varargin{2}; 0020 0021 % [C,IA,IB] = INTERSECT(A,B) returns index vectors IA and IB 0022 % such that C = A(IA) and C = B(IB) 0023 % [C,I] = SETDIFF(...) returns an index vector I such that C = A(I) 0024 0025 for ip = 1:2 % for each plane 0026 % compare response matrix with status 0027 [COR(ip).avail,IA,IB] = intersect(RSP(ip).ic,COR(ip).status); %RSP.ic and COR.status are compressed 0028 [C,IA] = setdiff(RSP(ip).ic,RSP(ip).ic(IA)); %check for rejected response matrix CORs 0029 if ~isempty(IA) 0030 disp('SortCORs Warning 1A: CORs in response matrix do not have valid status'); 0031 for ii = IA 0032 disp(COR(ip).name(ii,:)); 0033 end 0034 end 0035 0036 % compare result with fit selection 0037 [COR(ip).ifit,IA,IB] = intersect(COR(ip).avail,COR(ip).ifit); %COR.avail and COR.ifit are compressed 0038 [C,IB] = setdiff(COR(ip).ifit,COR(ip).ifit(IB)); %check for rejected fit CORs 0039 if ~isempty(IB) 0040 disp('SortCORs Warning 2B: CORs in fit not do not have valid status or not in response matrix'); 0041 for ii = IB 0042 disp(COR(ip).name(ii,:)); 0043 end 0044 end 0045 0046 end %end of plane loop 0047 0048 varargout{1} = COR;