annotate toolboxes/FullBNT-1.0.7/KPMtools/plotBox.m @ 0:cc4b1211e677 tip

initial commit to HG from Changeset: 646 (e263d8a21543) added further path and more save "camirversion.m"
author Daniel Wolff
date Fri, 19 Aug 2016 13:07:06 +0200
parents
children
rev   line source
Daniel@0 1 function [h, ht] =plotBox(box, col, str)
Daniel@0 2 % function h=plotBox(box, col, str)
Daniel@0 3 %
Daniel@0 4 % box = [xlow xhigh ylow yhigh]
Daniel@0 5 % col = color (default - red)
Daniel@0 6 % str = string printed at center (default '')
Daniel@0 7
Daniel@0 8 if nargin < 2, col = 'r'; end
Daniel@0 9 if nargin < 3, str = ''; end
Daniel@0 10
Daniel@0 11 box = double(box); % fails on single
Daniel@0 12
Daniel@0 13 h = plot([box(1) box(2) box(2) box(1) box(1)], [ box(3) box(3) box(4) box(4) box(3)]);
Daniel@0 14 set(h, 'color', col);
Daniel@0 15 set(h, 'linewidth', 2);
Daniel@0 16 if ~isempty(str)
Daniel@0 17 xc = mean(box(1:2));
Daniel@0 18 yc = mean(box(3:4));
Daniel@0 19 ht = text(xc, yc, str);
Daniel@0 20 else
Daniel@0 21 ht = [];
Daniel@0 22 end