www.pudn.com > calibr8.zip > vorient.m


function vectors = vorient(vectors)
%vectors = VORIENT(vectors)
%
%Orient vectors given as rows
%
%See also:
%  VSIZE, VNORM
%
%Note:
%  Vector is oriented if its coordinate which is maximal in magnitude
%  is positive.
%
%Radim Halir, Charles University Prague, halir@ms.mff.cuni.cz
%Created: 28.2.1997
%Last modified 9.4.1997

change = (max(vectors, 2) + min(vectors, 2)) < 0;
if (length(change) == 1)
  if (change)
    vectors = - vectors;
  end
else
  vectors(change, :) = - vectors(change, :);
end