Hello Jens.

Nothing sophisticated here.

print myVar

is considered by the parser as

print("myVar")

See "Calling function"/item 4.

https://help.scilab.org/docs/6.1.1/en_US/functions.html

S.

Le 06/12/2021 à 10:40, Jens Simon Strom a écrit :
Hi Samuel,
Your solution is quite sophisticated. To me it was confusing to call a function without the input being bracketed. And on top of this, that a variable of type /constant/ is accepted as a /string/ within the function. Scilab seems to be more flexible than I would dare to imagine before now. However it works fine. Thanks again.

Regards
Jens
-------------------------------------------------------------------------------------------------------------------------------------------------------------

Am 05.12.2021 um 20:02 schrieb Samuel Gougeon:
Le 04/12/2021 à 20:59, Samuel Gougeon a écrit :

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)

?


So, after your mail in private, you actually needs the variable's name inside the function. Then, the easiest way to do what you expect could be to pass only the name:

function  printc(name)
   execstr("c = "+name)
   //Drucken einer komplexen Zahl mit Betrag und Winkel/°
   mprintf([name+': %f /_%7.2f°\n'],abs(c),  180/%pi*atan(imag(c),real(c)))
endfunction
--> myVar = 3 - 2*%i
myVar =
3. - 2.i

--> printc myVar
myVar: 3.605551 /_ -33.69°

Regards
Samuel


_______________________________________________
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


_______________________________________________
users mailing list
users@lists.scilab.org
https://antispam.utc.fr/proxy/v3?i=SHV0Y1JZQjNyckJFa3dUQiblhF5YcUqtiWCaK_ri0kk&r=T0hnMlUyVEgwNmlmdHc1NTiGTQVgIg9a1MYkHb_GeosOO-jCQ_NnAucfYCLceioT&f=V3p0eFlQOUZ4czh2enpJS67gBdM2WVME2HqVPefA4FpGU6HeKhrEzrhzAHs-d_Wu&u=http%3A//lists.scilab.org/mailman/listinfo/users&k=ZVd0

--
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
http://www.utc.fr/~mottelet
_______________________________________________
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users

Reply via email to