How can I pass in multiple arguments to a function using a cell array in MATLAB 7.5 (R2007b)?
77 views (last 30 days)
Show older comments
I want to call a function which needs multiple input arguments. I wish to call this function using a single cell array to pass in these multiple arguments.
Accepted Answer
MathWorks Support Team
on 27 Jun 2009
It is possible to pass in multiple input variables to a function using a single cell array. The following example illustrates how this can be achieved.
Given the following function:
function myfun(arg1, arg2)
disp(arg1);
disp(arg2);
It can be called in the following way:
% Merged function call using a cell array.
mergedVariable = {1 'test'};
myfun(mergedVariable{:})
0 Comments
More Answers (0)
See Also
Categories
Find more on Structures in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!