The following function has two vector inputs. It appends vector 2 below 1 to make matrix, if vectors have unequal length it adds zeros to the shortest. I've commented out the form that doesn't work, the form that does work is left in. Why does it only work this way round?
function mmat = makemat(vector1,vector2)
diffv = length(vector1)-length(vector2);
% if sign(diffv)
% addi = zeros(1,diffv);
% vector2 = [vector2 addi];
% elseif sign(diffv)== -1
% addi = zeros(1,abs(diffv));
% vector1 = [vector1 addi];
if sign(diffv) == -1
addi = zeros(1,abs(diffv));
vector1 = [vector1 addi];
elseif sign(diffv)
addi = zeros(1,diffv);
vector2 = [vector2 addi];
else
end
mmat = [vector1;vector2];
end