function pltmat(a,matrixName,gridColor,fontSize);
%PLTMAT Display a matrix in a figure window.
%   PLTMAT(X,matrixName,gridColor,fontSize) takes
%   the matrix X and displays it using gridColor for the
%   XColor and YColor, fontSize for the FontSize of each
%   matrix element, and matrixName as the title for the 
%   plot. 

%   Ned Gulley, Denise Chen; June 1993.
%   Copyright (c) 1984-98 by The MathWorks, Inc.
%   $Revision: 5.5 $  $Date: 1997/11/21 23:26:47 $

% Clear the current axis
cla reset;
[m,n]=size(a);

% Place the text in the correct locations
% Index over number of rows
    for rowCnt=1:m,
        % Index over number of columns
        for colCnt=1:n,
            numberString=num2str(a(rowCnt,colCnt));
            text(colCnt-.5,m-rowCnt+.5,numberString, ...
                 'HorizontalAlignment','center', ...
                 'Color','y', ...
                 'FontWeight','bold', ...
                 'FontSize',fontSize);
        end;
    end;

set(gca,'Box','on', ...
        'Visible','on', ...
        'xLim',[0 n], ...
        'xGrid','on', ...
        'xTickLabel',[], ...
        'xTick',0:n, ...
        'yGrid','on', ...
        'yLim',[0 m], ...
        'yTickLabel',[], ...
        'yTick',0:m, ...
        'DataAspectRatio',[1, 1, 1], ... 
        'GridLineStyle',':', ...
        'LineWidth',3, ...
        'XColor',gridColor, ...
        'YColor',gridColor);

title(matrixName);
