Home > hfrc > matlab > @HFRC > sortS.m

sortS

PURPOSE ^

SORTS - this function sorts data rows of an HFRC object

SYNOPSIS ^

function [ h, i, dist ] = sortS( h, p )

DESCRIPTION ^

 SORTS - this function sorts data rows of an HFRC object
 spatially - i.e. by their grid coordinates.

 Usage: [ hfrc2, indice, dist ] = sortS( hfrc, point );
        [ hfrc2, indice, dist ] = sortS( hfrc, line );
        [ hfrc2, indice ] = sortS( hfrc, str );

 If the point argument is given, then data is sorted by distance from
 the given point.  If it is left out, then they are just sorted
 numerically - ie. first sorting by lat and then by lon.

 If the line argument is given (a 2 row matrix with long as first column
 and latitude as second column), then data is sorted by distance from
 the line defined by the two points.  The dist output argument in this
 case can be negative as explained in the dist_to_line function, even
 though the sort carried out will actually be with respect to absolute
 distance.

 The dist output arguments are the distances in the same order as the
 new HFRC object, hfrc2.

 Alternativelly, a string can be given in place of point.  The str can
 either be 'lat' or 'lon', indicating with respect to which component to
 sort by.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

     $Id: sortS.m,v 1.9 2003-06-17 02:05:38 dmk Exp $    

 Copyright (C) 2001 David M. Kaplan
 Licence: GPL

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:
Generated on Mon 18-Dec-2006 07:26:46 by m2html © 2003