[Scilab-users] Getting the variable name used for a function input argument

Samuel Gougeon sgougeon at free.fr
Sat Dec 4 20:59:59 CET 2021


Hello Jens,

Le 04/12/2021 à 20:39, Jens Simon Strom a écrit :
> Hi,
> Thanks for all the responses and sorry for not beeing able to answer 
> before now.
>
> The background of my question was to write a function for formatted 
> output of complex variables in polar form with
> mprintf like
> function printc(c)
>
> which returns the name of c on calling level, |c|, and the angle.
>
> I understand now that I have to write e. g.
>
> function printc(c,cname)
>
> where cname is the wanted string. This can even give some additional 
> freedeom in modifying the output name.


So, /unless you need to know the name *inside* printc() for some unsaid 
purpose/, what would be the difference between in one hand

[name, mag, arg] = printc(myvar, "myvar")

and on the other hand

name = "myvar";
[mag, arg] = printc(myvar)

?
BR
Samuel


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20211204/2dce91e2/attachment.htm>


More information about the users mailing list