[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Getting the name of a variable
From: |
Ploett Norbert |
Subject: |
Getting the name of a variable |
Date: |
Tue, 7 Sep 2004 13:39:01 +0200 |
Hi,
I want to write a function file which will automatically plot a curve and
the label of the curve. Like this:
% function plotcurve(curve)
% curve is a nx2 matrix, the first column containing x-values (time stamps),
% the second column the y-values (values).
function plotcurve(curve)
style = strcat(';', GETNAME(curve), ';');
plot(curve(:,1), curve(:,2), style)
endfunction
Then, when I enter at the command prompt:
> plotcurve(x)
the curve will be plotted and a label 'x ----' is displayed in the graph.
Is there a way to implement GETNAME(), which takes a parameter or variable
and returns it's name? Any ideas how this could be done?
Thanks,
Norbert
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------
- Getting the name of a variable,
Ploett Norbert <=