help-octave
[Top][All Lists]
Advanced

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

Re: create string with name of variable


From: Pantxo
Subject: Re: create string with name of variable
Date: Wed, 26 Sep 2018 08:54:58 -0500 (CDT)

LucaLuca wrote
> Example:
> 
> global SystemUnique;
> 
> functionPrintVariable(SystemUnique);
> 
> 
> function functionPrintVariable(var)
> 
>      print(name of SystemUnique)  
> 
> 
> endfunction
> 
>>> "SystemUnique"
> 
> how can i do it?
> 
> thank
> 
> 
> 
> 
> --
> Sent from:
> http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html

See "help inputname". The following function should do the trick

function disp_var_name (var)
  disp (inputname (1))
endfunction

a = 2;
disp_var_name (a)

Is it what you want?

Pantxo



--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html



reply via email to

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