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

Reply via email to