annotate toolboxes/FullBNT-1.0.7/KPMtools/plotBox.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 [h, ht] =plotBox(box, col, str)
wolffd@0 2 % function h=plotBox(box, col, str)
wolffd@0 3 %
wolffd@0 4 % box = [xlow xhigh ylow yhigh]
wolffd@0 5 % col = color (default - red)
wolffd@0 6 % str = string printed at center (default '')
wolffd@0 7
wolffd@0 8 if nargin < 2, col = 'r'; end
wolffd@0 9 if nargin < 3, str = ''; end
wolffd@0 10
wolffd@0 11 box = double(box); % fails on single
wolffd@0 12
wolffd@0 13 h = plot([box(1) box(2) box(2) box(1) box(1)], [ box(3) box(3) box(4) box(4) box(3)]);
wolffd@0 14 set(h, 'color', col);
wolffd@0 15 set(h, 'linewidth', 2);
wolffd@0 16 if ~isempty(str)
wolffd@0 17 xc = mean(box(1:2));
wolffd@0 18 yc = mean(box(3:4));
wolffd@0 19 ht = text(xc, yc, str);
wolffd@0 20 else
wolffd@0 21 ht = [];
wolffd@0 22 end