Daniel@0: function plotmat(matrix, textcolour, gridcolour, fontsize) Daniel@0: %PLOTMAT Display a matrix. Daniel@0: % Daniel@0: % Description Daniel@0: % PLOTMAT(MATRIX, TEXTCOLOUR, GRIDCOLOUR, FONTSIZE) displays the matrix Daniel@0: % MATRIX on the current figure. The TEXTCOLOUR and GRIDCOLOUR Daniel@0: % arguments control the colours of the numbers and grid labels Daniel@0: % respectively and should follow the usual Matlab specification. The Daniel@0: % parameter FONTSIZE should be an integer. Daniel@0: % Daniel@0: % See also Daniel@0: % CONFFIG, DEMMLP2 Daniel@0: % Daniel@0: Daniel@0: % Copyright (c) Ian T Nabney (1996-2001) Daniel@0: Daniel@0: [m,n]=size(matrix); Daniel@0: for rowCnt=1:m, Daniel@0: for colCnt=1:n, Daniel@0: numberString=num2str(matrix(rowCnt,colCnt)); Daniel@0: text(colCnt-.5,m-rowCnt+.5,numberString, ... Daniel@0: 'HorizontalAlignment','center', ... Daniel@0: 'Color', textcolour, ... Daniel@0: 'FontWeight','bold', ... Daniel@0: 'FontSize', fontsize); Daniel@0: end; Daniel@0: end; Daniel@0: Daniel@0: set(gca,'Box','on', ... Daniel@0: 'Visible','on', ... Daniel@0: 'xLim',[0 n], ... Daniel@0: 'xGrid','on', ... Daniel@0: 'xTickLabel',[], ... Daniel@0: 'xTick',0:n, ... Daniel@0: 'yGrid','on', ... Daniel@0: 'yLim',[0 m], ... Daniel@0: 'yTickLabel',[], ... Daniel@0: 'yTick',0:m, ... Daniel@0: 'DataAspectRatio',[1, 1, 1], ... Daniel@0: 'GridLineStyle',':', ... Daniel@0: 'LineWidth',3, ... Daniel@0: 'XColor',gridcolour, ... Daniel@0: 'YColor',gridcolour); Daniel@0: