help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: string to variable?


From: Peter Cloetens
Subject: Re: string to variable?
Date: Mon, 4 Sep 2006 19:20:16 +0200

or do you want 
eval(x)

On Sep 4, 2006, at 7:08 PM, José Luis García Pallero wrote:

thing_a = 2;
x = sprintf('%d[or %f, etc.]',thing_a);

2006/9/4, the_verge <address@hidden>:

I was wondering if there is a way to assign a value to a variable, and then
construct a string with the same characters as the variable, and then use it
to access the value of the original variable.  For Example:


thing_a = 2;

x = "thing_a";
%code here to merge the string "thing_a" with the variable thing_a
x



My hope is that running this script would return

x = 2


Is there a way to do this?

Thanks!
--
View this message in context: http://www.nabble.com/string-to-variable--tf2216346.html#a6138647
Sent from the Octave - General forum at Nabble.com.

_______________________________________________
Help-octave mailing list
address@hidden
https://www.cae.wisc.edu/mailman/listinfo/help-octave



--
*****************************************
José Luis García Pallero
address@hidden
(o<
/ / \
V_/_
Use Debian GNU/Linux and enjoy!
*****************************************
_______________________________________________
Help-octave mailing list



reply via email to

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