Documentation of range


Global Index (all files) (short | long) | Local Index (files in subdir) (short | long)


Function Synopsis

[ minval, maxval ] = range( array );

Help text

 function [ minval, maxval ] = range( array );

 Calculates the minimum and maximum values for the first
 row of a matrix.  The algorithm will also calculate the
 range of a column matrix.

 The algorithm disregards the NaNs.
 
 Todd Mitchell,  April 1994.


Cross-Reference Information

This function is called by

Listing of function range

function [ minval, maxval ] = range( array );

% If necessary, convert a column matrix to a row matrix.
array = array(:);

x = array( ~isnan( array ) );

if ~isempty(x)
minval = min( x );
maxval = max( x );
disp( sprintf( '\n minimum: %5d \n maximum: %5d', minval, maxval ) )
else
minval = NaN;
maxval = NaN;
disp( sprintf( '\n All values are "NaN"s.\n' ) );
end