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
[email protected]
http://lists.scilab.org/mailman/listinfo/users
_______________________________________________
users mailing list
[email protected]
http://lists.scilab.org/mailman/listinfo/users

Reply via email to