Home > wafo > wstats > cnr2cl.m

# cnr2cl

## PURPOSE

Column Number to Column Label.

I1 = cnr2cl(I)

## DESCRIPTION

``` CNR2CL Column Number to Column Label.

CALL:  I1 = cnr2cl(I)

I1 = character array of column labels.
I  = matrix of column numbers

CNR2CL transforms a column number into a column label, i.e.,
convert 'A'-'Z' to 1-25, 'a'-'z' to 26-50 and ' ' to 0.

CNR2CL is useful in conjuction with SUDG and CDR

## CROSS-REFERENCE INFORMATION

This function calls:
 char Create character array (string). isnumeric True for numeric arrays. warning Display warning message; disable or enable warning messages.
This function is called by:
 alias Alias structure of a fractional design. cdr Complete Defining Relation ffd Two-level Fractional Factorial Design fitmodel Fits response by polynomial sudg Some Useful Design Generators yates Calculates main and interaction effects using Yates' algorithm.

## SOURCE CODE

```001 function I1 = cnr2cl(I)
002 %CNR2CL Column Number to Column Label.
003 %
004 % CALL:  I1 = cnr2cl(I)
005 %
006 % I1 = character array of column labels.
007 % I  = matrix of column numbers
008 %
009 % CNR2CL transforms a column number into a column label, i.e.,
010 % convert 'A'-'Z' to 1-25, 'a'-'z' to 26-50 and ' ' to 0.
011 %
012 % CNR2CL is useful in conjuction with SUDG and CDR
013 %
014 % See also  cl2cnr, sudg, cdr
015
016
017 % Tested on: Matlab 5.3
018 % History:
019 % By Per A. Brodtkorb 16.03.2001
020
021 if isnumeric(I)
022   if any(I(:)>50),
023     warning('Column numbers must be less than 51!')
024     I1 = I;
025   else
026
027     % characters ' ','A' - 'Z' 'a'-'z'
028     str1=[' ',char(65:90) char(97:122)];
029     I1  = str1(abs(I)+1);
030     sgn         = sign(I);
031     sgn(sgn==0) = 1; % define sign(0) to 1.
032     sgn         = prod(sgn,2);
033     k = find(sgn<0);
034     if any(k),  % add '-' sign to strings
035       sgn(k) = 2;             % Define negative values to 2.
036       str0 = [' -']; % '+' and '-'
037       I1   = [str0(sgn).' I1];
038     end
039   end
040 else
041   I1 = I
042 end
043
044 return
045```

Mathematical Statistics
Centre for Mathematical Sciences
Lund University with Lund Institute of Technology

Comments or corrections to the WAFO group

Generated on Thu 06-Oct-2005 02:21:16 for WAFO by m2html © 2003