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
belongs to book: MATLAB: A Practical Introduction to Programming and Problem Solving|Stormy Attaway|Fourth Edition| Chapter number:10| Question number:6.10
All Answers
total answers (1)
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