How do I extract a variable name using varargin?
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello,
I am using varargin in a GUI to allow the user to enter in as many inputs as required, and then plot the input data on a figure. I would like to convert the input argumets into a string that I can use for a legend and/or a title on the figure. I cannot figure out how to extract the variable names using varargin. Is there a way to do this?
Thank You, -Eric
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 25 Mär. 2013
inputname() can still be used when you have varargin.
function blip(a, b, varargin)
for K = 1 : nargin
fprintf('input #%d came from variable "%s"\n', K, inputname(K) );
end
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Legend finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!