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
belongs to book: MATLAB: A Practical Introduction to Programming and Problem Solving|Stormy Attaway|Fourth Edition| Chapter number:4| Question number:30.4
All Answers
total answers (1)
makemat.m
function outmat = makemat(v1,v2)
len1 = length(v1);
len2 = length(v2);
if len1 ~= len2
if len1>len2
diff = len1-len2;
addend = zeros(1,diff);
v2 = [v2 addend];
else
diff = len2-len1;
addend = zeros(1,diff);
v1 = [v1 addend];
end
end
outmat = [v1;v2];
need an explanation for this answer? contact us directly to get an explanation for this answer