Code covered by the BSD License  

Highlights from
smallestMin

from smallestMin by Brian Schrameck
The smallest component of all vector and/or matrix inputs.

smallestMin (varargin)
% SMALLESTMIN(X) The smallest component of all vector and/or matrix inputs.
%   SMALLESTMIN(X), where X is any number of vectors and/or matrices, is 
%   the smallest component present in any of these structures.  
%   SMALLESTMIN(X) is consistent with MATLAB's built-in MIN(X) for vectors
%   only!! SMALLESTMIN(X) for a matrix returns the equivalent of 
%   MIN(MIN(X)).  SMALLESTMIN accepts mixed inputs of vectors and matrices.
%   A matrix is defined as having exactly 2 dimensions.
%
%   VALID INPUTS: row and column vectors and 2-D matrices.  These can
%                 contain characters, complex numbers, and numerics.
%                 Logicals, doubles, singles, int8, uint8, int16, int32,
%                 and uint32 are also valid.
%   INVALID INPUTS: cell arrays, 64-bit signed and unsigned values,
%   structures, function handles, user classes, and java classes.
%
%   These lists may not be all-inclusive.
%
%   Ex 1: If A = [1 2 3 4] and B = [-1   then smallestMin(A,B) returns -1.
%                                    2
%                                    3
%                                    4]
%
%   Ex 2: If A = [1 2   and B = [5 6 7 8] then smallestMin(A,B) returns 1.
%                 3 4]
%
%   Author:  Brian A. Schrameck
%   Version: v0.1
%   Date:    07/15/2009
%   Email:   <a href="mailto:schrameckbrian+smallestMin@gmail.com">schrameckbrian+smallestMin@gmail.com</a>
%
%   See also min, max, isnumeric, and largestMax (available on the MATLAB
%   File Exchange).

function smallestVal = smallestMin (varargin)

smallestVal = 0;

if ( length(varargin) < 1 )
    error('At least 1 argument must be present!')
end

for i=1:length(varargin)
    % This will catch at least most of the bad stuff thrown at it.  It will
    % not catch uint64/int64, or function handles; probably some other
    % stuff too.
    if ( (~isvector(varargin{i}) && ndims(varargin{i}) ~= 2 ) || ...
            iscell(varargin{i}) )
        error('Argument %d is not a vector or 2D matrix!', i)
    end
    % We will error out here if we didn't catch something earlier, as min
    % will die.
    curMin = min(min(varargin{i}));
    if ( i == 1 )
        % First time through is always the min value.
        smallestVal = curMin;
    elseif ( curMin < smallestVal )
        % Compare against current smallest value.
        smallestVal = curMin;
    end
end
end

Contact us at files@mathworks.com