wolffd@0: function [h, ht] =plotBox(box, col, str) wolffd@0: % function h=plotBox(box, col, str) wolffd@0: % wolffd@0: % box = [xlow xhigh ylow yhigh] wolffd@0: % col = color (default - red) wolffd@0: % str = string printed at center (default '') wolffd@0: wolffd@0: if nargin < 2, col = 'r'; end wolffd@0: if nargin < 3, str = ''; end wolffd@0: wolffd@0: box = double(box); % fails on single wolffd@0: wolffd@0: h = plot([box(1) box(2) box(2) box(1) box(1)], [ box(3) box(3) box(4) box(4) box(3)]); wolffd@0: set(h, 'color', col); wolffd@0: set(h, 'linewidth', 2); wolffd@0: if ~isempty(str) wolffd@0: xc = mean(box(1:2)); wolffd@0: yc = mean(box(3:4)); wolffd@0: ht = text(xc, yc, str); wolffd@0: else wolffd@0: ht = []; wolffd@0: end