Write a function numbers that will create a matrix in which every element stores the same number num. Either two or three arguments will be passed to the function
belongs to book: MATLAB: A Practical Introduction to Programming and Problem Solving|Stormy Attaway|Fourth Edition| Chapter number:10| Question number:2.10
All Answers
total answers (1)
numbers.m
function outmat = numbers(num,varargin)
if nargin == 2
outmat = ones(varargin{1}) * num;
else
outmat = ones(varargin{1},varargin{2}) * num;
end
end
need an explanation for this answer? contact us directly to get an explanation for this answer