
% outfile = makmatrix(infile, windsiz, hopsiz)    8/02
%     converts a row or column to a matrix of columns of length windsiz i.e. windsiz rows 
%     each column is a time frame and they are separated by hopsiz
%     ie output numbers in COLUMNS so use waterfall of the transpose to plot

function    outmat = makmatrix(infile, NN, HH);

% test = 1:1000;
% nhops = 20;
% NN = 15;
% HH = 5;

[nr, nc] = size(infile);
if nr > nc, infile = infile'; end   % make input row matrix

nhops = (length(infile) - NN)/HH  + 1
clear outmat
for jj = 0 : nhops - 1
    begind = (jj)*HH + 1;
    endind = begind + NN-1;
    outmat(jj+1,:) = infile(begind:endind);
end
outmat = outmat';
[nr, nc] = size(outmat);
fprintf('infile is %.0f samples; outmat is windsiz = %.0f by nframes = %.0f\n', length(infile), nr, nc);