[Top][All Lists]

[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


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)

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?



Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

[Prev in Thread] Current Thread [Next in Thread]