Q:

A function can return a vector as a result. Write a function vecout that will receive one integer argument and will return a vector that increments from the value of the input argument to its value plus 5, using the colon operator. For example

0

A function can return a vector as a result. Write a function vecout that will receive one integer argument and will return a vector that increments from the value of the input argument to its value plus 5, using the colon operator. For example

>> vecout(4)

ans =

4 5 6 7 8 9

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

 vecout.m

function outvec = vecout(innum)

% Create a vector from innum to innum + 5

% Format of call: vecout(input number)

% Returns a vector input num : input num+5

outvec = innum:innum+5;

end

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now