You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: imMin.m
    path of file: ./repos/matImage/matImage/imExplore
    
    the code of the file until where you have to start completion: function s = imMin(img, varargin)
%IMMIN Minimum value of a grayscale image, or of each color component
%
%   S = imMin(IMG)
%   Computes the minimum value of pixels in image IMG. If image is grayscale
%   image, the result is a scalar. If image is a color image, the result is
%   1-by-3 row vector, each componenent corresponding to one color of the
%   image.
%
%   S = imMin(IMG, MASK)
%   Computes the minimum value only in the area specified by MASK.
%
%   S = imMin(..., 'color', COL)
%   Forces the function to consider the image as color (if COL is TRUE) or
%   as grascale (if COL is FALSE). This can be useful for vector image with
%   more than 3 color components. 
%
%
%   Example
%   % apply to cameraman image
%   img = imread('cameraman.tif');
%   imMin(img)
%   ans =
%       253
%
%   % apply to a RGB image
%   img = imread('peppers.png');
%   imMin(img)
%   ans =
%       255   255   255
%
%   See also
%   imMax, imMedian, imMean
%
% ------
% Author: David Legland
% e-mail: david.legland@grignon.inra.fr
% Created: 2010-07-30,    using Matlab 7.9.0.529 (R2009b)
% Copyright 2010 INRA - Cepia Software Platform.


%% Process input arguments


    
function s = imMin(img, varargin)
%IMMIN Minimum value of a grayscale image, or of each color component
%
%   S = imMin(IMG)
%   Computes the minimum value of pixels in image IMG. If image is grayscale
%   image, the result is a scalar. If image is a color image, the result is
%   1-by-3 row vector, each componenent corresponding to one color of the
%   image.
%
%   S = imMin(IMG, MASK)
%   Computes the minimum value only in the area specified by MASK.
%
%   S = imMin(..., 'color', COL)
%   Forces the function to consider the image as color (if COL is TRUE) or
%   as grascale (if COL is FALSE). This can be useful for vector image with
%   more than 3 color components. 
%
%
%   Example
%   % apply to cameraman image
%   img = imread('cameraman.tif');
%   imMin(img)
%   ans =
%       253
%
%   % apply to a RGB image
%   img = imread('peppers.png');
%   imMin(img)
%   ans =
%       255   255   255
%
%   See also
%   imMax, imMedian, imMean
%
% ------
% Author: David Legland
% e-mail: david.legland@grignon.inra.fr
% Created: 2010-07-30,    using Matlab 7.9.0.529 (R2009b)
% Copyright 2010 INRA - Cepia Software Platform.


%% Process input arguments

% detect if image is color
color = isColorImage(img);

% check if user specified 'color' option
if length(varargin)>1
    var = varargin{end