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