CL2CNR Column Label to Column Number CALL: I1 = cl2cnr(I) I1 = matrix of column numbers I = character array of column labels. CL2CNR transforms a column label into a column number, i.e., convert 'A'-'Z' to 1-25, 'a'-'z' to 26-50 and ' ' to 0. CL2CNR is useful in conjuction with SUDG and CDR See also cnr2cl, sudg, cdr
Convert to double precision. | |
True for character array (string). | |
Display warning message; disable or enable warning messages. |
Alias structure of a fractional design. | |
Complete Defining Relation | |
Two-level Fractional Factorial Design |
001 function I1 = cl2cnr(I) 002 %CL2CNR Column Label to Column Number 003 % 004 % CALL: I1 = cl2cnr(I) 005 % 006 % I1 = matrix of column numbers 007 % I = character array of column labels. 008 % 009 % CL2CNR transforms a column label into a column number, i.e., 010 % convert 'A'-'Z' to 1-25, 'a'-'z' to 26-50 and ' ' to 0. 011 % 012 % CL2CNR is useful in conjuction with SUDG and CDR 013 % 014 % See also cnr2cl, sudg, cdr 015 016 017 % Tested on: Matlab 5.3 018 % History: 019 % By Per A. Brodtkorb 16.03.2001 020 021 if ischar(I) 022 sgn = ones(size(I)); 023 sgn(I=='-') = -1; 024 sgn = prod(sgn,2); 025 026 I1 = double(I)-64; % Convert A-Z to 1-25 027 I1(I1<0)=0; % Convert ' ' to 0 028 k = find(I>=97); 029 if any(k), % Convert a-z to 26-50 030 I1(k) = I(k)-96+26; 031 end 032 I1 = sort(I1,2); 033 034 if any(I1(:)>50), warning('Illegal column label!'), end 035 I1(:,end) = I1(:,end).*sgn; 036 else 037 I1 = I; 038 end 039 040 % Remove starting zeros 041 [ix,iy] = find(I1~=0); 042 iy = min(iy); 043 if ~isempty(iy) & (iy>1), I1 = I1(:,iy:end); end 044 045 return 046
Comments or corrections to the WAFO group