Q:

Write a function unwind that will receive a matrix as an input argument. It will return a row vector created columnwise from the elements in the matrix. If the number of expected output arguments is two, it will also return this as a column vector

0

Write a function unwind that will receive a matrix as an input argument. It will return a row vector created columnwise from the elements in the matrix. If the number of expected output arguments is two, it will also return this as a column vector. 

All Answers

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

unwind.m

function [rowvec, varargout] = unwind(mat)

% Returns a row vector created columnwise from the

% input matrix, and possibly also a column vector

% Format of call: unwind(matrix)

% Returns a row vector from the matrix and if two

% output arguments are expected, also a column vector

rowvec = mat(1:end);

if nargout == 2

 varargout{1} = rowvec';

end

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