%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Name: scaleVec.m
% Author: J. Kristoffer Hultgren
%
% Description:
%
% Rescales a vector
%
% Input:  data  - Input vector
%         span  - Original vector size
%         spanS - Resulting vector size
%
% Output: -
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function out = scaleVec(data, span, spanS)

lim = round(span / spanS);
new = zeros(span, span);
m = 1;
while (lim * (m - 1) + 1) <= span
    n = 1;
    while (lim * (n - 1) + 1) <= span
        new((lim*(n-1)+1),(lim*(m-1)+1)) = data((lim*(n-1)+1),(lim*(m-1)+1));
        n = n+1;
    end
    m = m+1;
end
out = new;