Q:

Write a function “separatethem” that will receive one input argument which is a structure containing fields named ‘length’ and ‘width’, and will return the two values separately. Here is an example of calling the function:

0

>> myrectangle = struct('length',33,'width',2);

>> [l w] = separatethem(myrectangle)

l =

 33

w =

 2

All Answers

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

separatethem.m

function [len, wid] = separatethem(rect)

len = rect.length;

wid = rect.width;

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