merge parameter inside a function

8 Ansichten (letzte 30 Tage)
Gabriele
Gabriele am 5 Feb. 2013
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 Kommentare
Gabriele
Gabriele am 5 Feb. 2013
Bearbeitet: Gabriele am 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 am 5 Feb. 2013
Please place this as an answer so it can be accepted.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

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

Weitere Antworten (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by