


sameValueCol: Return the index of same-value column in a matrix
Usage: colIndex=sameValueCol(x)


0001 function colIndex=sameValueCol(x) 0002 % sameValueCol: Return the index of same-value column in a matrix 0003 % Usage: colIndex=sameValueCol(x) 0004 0005 % Roger Jang, 20060818 0006 0007 if nargin<1, selfdemo; return; end 0008 0009 colIndex=sum(abs(diff(x)))==0; 0010 0011 % ====== Self demo 0012 function selfdemo 0013 x=[1 2 3 9 ; 1 5 7 9; 1 8 2 9]; 0014 colIndex=feval(mfilename, x); 0015 fprintf('x=\n'); disp(x); 0016 fprintf('colIndex=%s(x) produces\n', mfilename); 0017 fprintf('colIndex=\n'); disp(colIndex);