<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Hello Jens.</p>
<p>Nothing sophisticated here. <br>
</p>
<p>print myVar</p>
<p>is considered by the parser as <br>
</p>
<p>print("myVar")</p>
<p>See "Calling function"/item 4.<br>
</p>
<p><a class="moz-txt-link-freetext" href="https://help.scilab.org/docs/6.1.1/en_US/functions.html">https://help.scilab.org/docs/6.1.1/en_US/functions.html</a><br>
</p>
<p>S.<br>
</p>
<div class="moz-cite-prefix">Le 06/12/2021 à 10:40, Jens Simon Strom
a écrit :<br>
</div>
<blockquote type="cite"
cite="mid:8de44f6d-31df-1f6a-9210-750c2208f3a7@hslmg.de">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
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 moz-txt-link-freetext" href="mailto:users@lists.scilab.org" moz-do-not-send="true">users@lists.scilab.org</a>
<a class="moz-txt-link-freetext" href="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" moz-do-not-send="true">http://lists.scilab.org/mailman/listinfo/users</a>
</pre>
</blockquote>
<br>
<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="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">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</a>
</pre>
</blockquote>
<pre class="moz-signature" cols="72">--
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
<a class="moz-txt-link-freetext" href="http://www.utc.fr/~mottelet">http://www.utc.fr/~mottelet</a>
</pre>
</body>
</html>