function [X] = VectorToMatrix( v, w ) % v is a row vector % w is the width of the desired matrix % Returns X with the number of rows required by v, w % .. padded with zeros at end if necessary. % % 27 Jan 2009 - D.Bozarth, SSU Engineering Science % X = []; start = 1; vsz = size( v, 2 ); while start <= vsz finit = start + w - 1; padz = []; if vsz < finit padz = zeros(1, finit - vsz); finit = vsz; end row = [v(1, start:finit) padz]; X = [X ; row]; start = finit + 1; end % % end script