annotate toolboxes/FullBNT-1.0.7/netlab3.3/plotmat.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
rev   line source
wolffd@0 1 function plotmat(matrix, textcolour, gridcolour, fontsize)
wolffd@0 2 %PLOTMAT Display a matrix.
wolffd@0 3 %
wolffd@0 4 % Description
wolffd@0 5 % PLOTMAT(MATRIX, TEXTCOLOUR, GRIDCOLOUR, FONTSIZE) displays the matrix
wolffd@0 6 % MATRIX on the current figure. The TEXTCOLOUR and GRIDCOLOUR
wolffd@0 7 % arguments control the colours of the numbers and grid labels
wolffd@0 8 % respectively and should follow the usual Matlab specification. The
wolffd@0 9 % parameter FONTSIZE should be an integer.
wolffd@0 10 %
wolffd@0 11 % See also
wolffd@0 12 % CONFFIG, DEMMLP2
wolffd@0 13 %
wolffd@0 14
wolffd@0 15 % Copyright (c) Ian T Nabney (1996-2001)
wolffd@0 16
wolffd@0 17 [m,n]=size(matrix);
wolffd@0 18 for rowCnt=1:m,
wolffd@0 19 for colCnt=1:n,
wolffd@0 20 numberString=num2str(matrix(rowCnt,colCnt));
wolffd@0 21 text(colCnt-.5,m-rowCnt+.5,numberString, ...
wolffd@0 22 'HorizontalAlignment','center', ...
wolffd@0 23 'Color', textcolour, ...
wolffd@0 24 'FontWeight','bold', ...
wolffd@0 25 'FontSize', fontsize);
wolffd@0 26 end;
wolffd@0 27 end;
wolffd@0 28
wolffd@0 29 set(gca,'Box','on', ...
wolffd@0 30 'Visible','on', ...
wolffd@0 31 'xLim',[0 n], ...
wolffd@0 32 'xGrid','on', ...
wolffd@0 33 'xTickLabel',[], ...
wolffd@0 34 'xTick',0:n, ...
wolffd@0 35 'yGrid','on', ...
wolffd@0 36 'yLim',[0 m], ...
wolffd@0 37 'yTickLabel',[], ...
wolffd@0 38 'yTick',0:m, ...
wolffd@0 39 'DataAspectRatio',[1, 1, 1], ...
wolffd@0 40 'GridLineStyle',':', ...
wolffd@0 41 'LineWidth',3, ...
wolffd@0 42 'XColor',gridcolour, ...
wolffd@0 43 'YColor',gridcolour);
wolffd@0 44