Passing multiple arguments

1 view (last 30 days)
Talib
Talib on 13 Apr 2012
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

Accepted Answer

Walter Roberson
Walter Roberson on 13 Apr 2012
dcell = mat2cell(data, ones(1,size(data,1)), size(data,2));
inst([0 1 1 1], dcell{:});
  1 Comment
Talib
Talib on 13 Apr 2012
Thank you a lot for your help
This surely resolve my problem
Thanks

Sign in to comment.

More Answers (0)

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!