merge parameter inside a function

8 visualizzazioni (ultimi 30 giorni)
Gabriele
Gabriele il 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 Commenti
Gabriele
Gabriele il 5 Feb 2013
Modificato: Gabriele il 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 il 5 Feb 2013
Please place this as an answer so it can be accepted.

Accedi per commentare.

Risposta accettata

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

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by