merge parameter inside a function

1 view (last 30 days)
Dear all,
would it be possible inside a function to merge all the arguments (that in my case are cell array) in a cell array?
I would like something like this
function try(cellarray1, cellarray2, cellarray3)
for i = 1:nargin
LegendCellArray = inputname(i);
MergedCellArray = putthisparamenterinside(i);
end
end
Thanks Gabriele
  2 Comments
Gabriele
Gabriele on 5 Feb 2013
Edited: Gabriele on 5 Feb 2013
Solved...
function try(varargin)
for i = 1:nargin
LegendCellArray(i) = inputname(i);
MergedCellArray{i} = varargin{i};
end
end
José-Luis
José-Luis on 5 Feb 2013
Please place this as an answer so it can be accepted.

Sign in to comment.

Accepted Answer

Gabriele
Gabriele on 5 Feb 2013
Solved...
function try(varargin)
for i = 1:nargin
LegendCellArray(i) = inputname(i);
MergedCellArray{i} = varargin{i};
end
end

More Answers (0)

Categories

Find more on Function Creation 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!