What does the blanks function return when a 0 is passed to it? A negative number? Write a function myblanks that does exactly the same thing as the blanks function, using the programming method. Here are some examples of calling it:
belongs to book: MATLAB: A Practical Introduction to Programming and Problem Solving|Stormy Attaway|Fourth Edition| Chapter number:7| Question number:10.7
All Answers
total answers (1)
myblanks.m
function outa = myblanks(num)
% Mimics the blanks function
% Format of call: myblanks(n)
% Returns a string of n blanks
outa = '';
if num > 0
for i = 1:num
outa = [outa ' '];
end
end
end
need an explanation for this answer? contact us directly to get an explanation for this answer