


sameValueRow: Return the index of same-value row in a matrix
Usage: rowIndex=sameValueRow(x)


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