Write a function myones that will receive two input arguments n and m and will return an nxm matrix of all ones. Do NOT use any builtin functions (so, yes, the code will be inefficient). Here is an example of calling the function:
belongs to book: MATLAB: A Practical Introduction to Programming and Problem Solving|Stormy Attaway|Fourth Edition| Chapter number:5| Question number:15.5
All Answers
total answers (1)
myones.m
function outmat = myones(n,m)
for i = 1:n
for j = 1:m
outmat(i,j) = 1;
end
end
end
need an explanation for this answer? contact us directly to get an explanation for this answer