function A = makemat(v,w) % makemat - Exercise % MATLAB® - A Practical Introduction to Programming % and Problem Solving - Sixth Edition - Stormy Attaway % p. 156 - n. 29 % 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 lengths. If that is the case, add 0’s to the % end of one vector first to make it as long as the other. % For example, a call to the function might be: % >>makemat(1:4, 2:7) % ans = % 1 2 3 4 0 0 % 2 3 4 5 6 7 lv=length(v); lw=length(w); if lvlw w(lv)=0; end A=[v;w]; end