Re: Renaming variables using strings



Kristjan Tabri wrote:
>
>
> Hi all,
> I have a big database with several variables inside. Now I would
> like
> to assign some other names for the variables. One script makes a
> strings of these variable names according to some routine. For
> example, i have a variable in database called F101 and the script
> makes a string 'F101'. I would like to rename the variable F101 as
> dataF. As I have the variable name just as an automatically
> generated string (by ['F','101'], I do not know how to rename the
> variable. Commands dataF='F101' and dataF=str2num('F101') do not
> work
> in such a case. When dataF='F101' is used the existing variable is
> just rewritten and obtains a value of the string and
> str2num('F101')
> does not work as F101 cannot be turned into a number.
>
> Any idea how to do it?
>
> Regards,
> kristjan

use eval
str='F101'
eval(['DataF=',str,';'])

NBT
.



Relevant Pages

  • using a config file
    ... The previous programmer used a config file to load parameters for a ... database connect string. ... I'd also like to know how to rename the file and still have it work. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Renaming variables using strings
    ... > I have a big database with several variables inside. ... i have a variable in database called F101 and the script ... > makes a string 'F101'. ... I would like to rename the variable F101 as ...
    (comp.soft-sys.matlab)
  • Renaming variables using strings
    ... I have a big database with several variables inside. ... i have a variable in database called F101 and the script ... makes a string 'F101'. ... I would like to rename the variable F101 as ...
    (comp.soft-sys.matlab)
  • Re: A little Rolodex [revised]
    ... including alpha sort and searching for any embedded string, ... In this application, a database is a directory, ... you may optionally provide any alternate UCASE program, ... NN -> first store NN as key length ...
    (comp.sys.hp48)
  • Re: return multiple rows from sql statement
    ... strings from input values is almost certainly a safe path to SQL ... Also, being a MySQL function, it knows what MySQL needs or uses. ... All characters that are entered in the fields make their way into the database unaltered. ... The insert of what surprisinlgly was NOT a syntax error, but a string called "mysql_insert_id" into an integer field resulted in the value zero being put in. ...
    (comp.lang.php)

Loading