Variable number of output arguments
5 views (last 30 days)
Show older comments
Hi everyone,
I am wondering how I can dynamically change the number of returned arguments I want to receive from a function. Example:
function foo()
a = fooyootoo(3)
end
function varargout = fooyootoo(n)
for i = 1:n
varargout{i}=i;
end
end
I would like to define 'a' so that it is a cell array with a dynamic number of cells between 1 and n. Note, I do not want to execute the function fooyootoo() more than once.
Thanks,
James
0 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Whos in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!