function p = make_SubplotPos(h_bnds,v_bnds, h_plots, v_plots)

% p = make_SubplotPos(h_bnds, v_bnds, h_plots, v_plots)
%
% INPUTS:
%   h_bnds  = horizontal bounds in relative units
%   v_bnds  = vertical bounds in relative units
%   h_plots = number of horizontal plots
%   h_plots = number of vertical plots
%
% OUTPUT:
%   p = a matrix of position vectors [LEFT BOTTOM WIDTH HEIGHT]
%
% EXAMPLE:
%   pos = make_SubplotPos([0.1 0.9],[0.05 1.0], 3, 2);
%
%   This will make 6 position vectors for 3 horizontal & 2 vertical
%   axes

p = ones(h_plots*v_plots,4) * NaN; % Predim position vector as matrix

W = (h_bnds(2)  - h_bnds(1))/h_plots;
H = (v_bnds(2)  - v_bnds(1))/v_plots;

L = ((0:h_plots-1)*W + h_bnds(1))'; % Want cols
B = ((0:v_plots-1)*H + v_bnds(1))'; 

L = L * ones(1,v_plots); % Duplicate rr times
B = B * ones(1,h_plots);

p(:,1) = reshape(L,v_plots*h_plots,1);
p(:,2) = sort(reshape(B,v_plots*h_plots,1),'descend');

p(:,3) = W-0.1; % ADJUSTABLE !!
p(:,4) = H-0.1; % ADJUSTABLE !!

clearvars -except p