Passing multiple arguments
1 view (last 30 days)
Show older comments
i have created 2 funtions, 1 is
function inst(code,varargin)
where i can input something like this
inst([0 1 1 1],[1],[1 0],[1 1])
but how i pass it a data variable which is same but not in separate variables, but like a matrix
data=[1 0;1 1; 0 1];
how do i get these into separate variables and pass them to inst function
keeping in mind that data may very in length (will have to create and pass more variables)
plz help me.
I have only 1 week left, and i am stuck
0 Comments
Accepted Answer
Walter Roberson
on 13 Apr 2012
dcell = mat2cell(data, ones(1,size(data,1)), size(data,2));
inst([0 1 1 1], dcell{:});
More Answers (0)
See Also
Categories
Find more on Variables 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!