MATLAB: Write a function called “makemat” that will receive two row vectors as input arguments, and from them create and return a matrix with two rows. You may not assume that the length of the vectors is known. Also, the vectors may be of different length

functionmatrix

So far I have this but it's not working when the two vectors are different lengths:
function [C] = makemat(A, B)
if length(B)>length(A)
for n=length(B)
if ~A(n)
A(n)==0
end
end
elseif length(A)>length(B)
for m=length(A)
if ~B(m)
B(m)==0
end
end
end
C(1,:)=A
C(2,:)=B
end

Best Answer

function [C] = ArmStrong(A, B)
if length(A)==length(B)
X = A ;
Y = B ;
elseif length(B)>length(A)
X = zeros(size(B)) ;
X(1:length(A)) = A ;
Y = B ;
elseif length(A)>length(B)
Y = zeros(size(A)) ;
Y(1:length(B)) = B ;
X = A ;
end
C(1,:)=X ;
C(2,:)=Y ;
end
There are multiple ways to achieve the above. In simple:
L = [length(A), length(B)] ;
C = zeros(2,max(L)) ;
C(1,1:L(1)) = A ;
C(2,1:L(2)) = B ;