<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
Hi Samuel,<br>
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 <i>constant</i> is accepted as a <i>string</i>
within the function. Scilab seems to be more flexible than I would
dare to imagine before now. However it works fine. Thanks again.<br>
<br>
Regards<br>
Jens<br>
-------------------------------------------------------------------------------------------------------------------------------------------------------------
<br>
<br>
<div class="moz-cite-prefix">Am 05.12.2021 um 20:02 schrieb Samuel
Gougeon:<br>
</div>
<blockquote type="cite"
cite="mid:66966863-f3d9-d325-d840-4a2e90d5b6da@free.fr">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<div class="moz-cite-prefix">Le 04/12/2021 Ã 20:59, Samuel Gougeon
a écrit :<br>
</div>
<blockquote type="cite"
cite="mid:96236b82-9bd2-34a1-b9d0-d832dad35e0f@free.fr">
<meta http-equiv="Content-Type" content="text/html;
charset=UTF-8">
<p>So, <i>unless you need to know the name <b>inside</b>
printc() for some unsaid purpose</i>, what would be the
difference between in one hand<br>
<br>
<font face="monospace">[name, mag, arg] = printc(myvar,
"myvar")<br>
</font><br>
and on the other hand<br>
<br>
<font face="monospace">name = "myvar";<br>
[mag, arg] = printc(myvar)<br>
</font><br>
?<br>
</p>
</blockquote>
<p><br>
</p>
<p>So, after your mail in private, you actually needs the
variable's name inside the function.<br>
Then, the easiest way to do what you expect could be to pass
only the name:<br>
</p>
<pre style="font-family:Monospaced;font-style:normal;font-size:13.0;"><span style="color:rgb(176,24,19);">function</span> <span style="color:rgb(0,0,0);text-decoration:underline;">printc</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(131,67,16);font-weight:bold;">name</span><span style="color:rgb(74,85,219);">)</span>
<span style="color:rgb(50,185,185);">execstr</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">c = </span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(92,92,92);">+</span><span style="color:rgb(131,67,16);font-weight:bold;">name</span><span style="color:rgb(74,85,219);">)</span>
<span style="color:rgb(100,174,100);font-style:italic;">//Drucken einer komplexen Zahl mit Betrag und Winkel/°</span>
<span style="color:rgb(50,185,185);">mprintf</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(74,85,219);">[</span><span style="color:rgb(131,67,16);font-weight:bold;">name</span><span style="color:rgb(92,92,92);">+</span><span style="color:rgb(188,143,143);">'</span><span style="color:rgb(188,143,143);">: %f /_%7.2f°\n</span><span style="color:rgb(188,143,143);">'</span><span style="color:rgb(74,85,219);">]</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(50,185,185);">abs</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(0,0,0);">c</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">,</span> <span style="color:rgb(188,143,143);">180</span><span style="color:rgb(92,92,92);">/</span><span style="color:rgb(218,112,214);">%pi</span><span style="color:rgb(92,92,92);">*</span><span style="color:rgb(50,185,185);">atan</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(50,185,185);">imag</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(0,0,0);">c</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(50,185,185);">real</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(0,0,0);">c</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(74,85,219);">)</span>
<span style="color:rgb(176,24,19);">endfunction
<font face="monospace">
</font></span></pre>
<font face="monospace">--> myVar = 3 - 2*%i</font><br>
<font face="monospace"> myVar = </font><br>
<font face="monospace"> 3. - 2.i</font><br>
<br>
<font face="monospace">--> printc myVar</font><br>
<font face="monospace">myVar: 3.605551 /_ -33.69°</font><br>
<p>Regards<br>
Samuel<br>
</p>
<br>
<fieldset class="moz-mime-attachment-header"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a>
<a class="moz-txt-link-freetext" href="http://lists.scilab.org/mailman/listinfo/users">http://lists.scilab.org/mailman/listinfo/users</a>
</pre>
</blockquote>
<br>
</body>
</html>