[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Getting the name of a variable
From: |
Etienne Grossmann |
Subject: |
Re: Getting the name of a variable |
Date: |
Tue, 7 Sep 2004 08:09:41 -0400 |
User-agent: |
Mutt/1.4.2.1i |
Hi Ploett
in
function s = tar(varargin)
...
s.(deblank(argn(i,:))) = varargin{i};
deblank(argn(i,:)) is a string containing the name of the i'th
argument.
Hth,
Etienne
On Tue, Sep 07, 2004 at 01:39:01PM +0200, Ploett Norbert wrote:
# 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
# -------------------------------------------------------------
#
--
Etienne Grossmann ------ http://www.cs.uky.edu/~etienne
-------------------------------------------------------------
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
-------------------------------------------------------------