<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Le 23/11/2019 à 15:35, Samuel Gougeon a
écrit :<br>
</div>
<blockquote type="cite"
cite="mid:19df4652-db1e-f43d-11af-3a64667005cb@free.fr">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<div class="moz-cite-prefix">Hello<span style="color:rgb(0,0,0)">
Philipp, and to all (former ;-) matlabers,</span></div>
<div class="moz-cite-prefix"><span style="color:rgb(0,0,0)"><br>
</span></div>
<div class="moz-cite-prefix"><span style="color:rgb(0,0,0)"></span>Le
16/10/2019 à 11:46, P M a écrit :<br>
</div>
<blockquote type="cite"
cite="mid:CACf7ODujLr-wufzBHkmar+y-3g6GKD6nZVDsSSRgdTH68xLaDw@mail.gmail.com">
<meta http-equiv="content-type" content="text/html;
charset=UTF-8">
<div dir="ltr">
<div>Dear experts,</div>
<div><br>
</div>
<div>trying to convert a matlab code to scilab I come across
following line:</div>
<div>
<pre style="font-family:Monospaced;font-style:normal"><span style="color:rgb(74,85,219)">[~</span><span style="color:rgb(0,0,0)">,~</span><span style="color:rgb(0,0,0)"></span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(0,0,0)">Minstances_hat</span><span style="color:rgb(74,85,219)">]</span> <span style="color:rgb(92,92,92)">=</span> <span style="color:rgb(0,0,0)">unique</span><span style="color:rgb(74,85,219)">(</span><span style="color:rgb(0,0,0)">B</span><span style="color:rgb(74,85,219)">(</span><span style="color:rgb(255,170,0)">:</span><span style="color:rgb(74,85,219)">)</span><span style="color:rgb(74,85,219)">)</span><span style="color:rgb(0,0,0)">;
</span></pre>
<pre style="font-family:Monospaced;font-style:normal"><span style="color:rgb(0,0,0)">How to replace the "~" symbol?
</span></pre>
<pre style="font-family:Monospaced;font-style:normal"><span style="color:rgb(0,0,0)">B is the blue channel of a RGB image...hence a m x n matrix of integers (type(B) = 8 )
</span></pre>
</div>
</div>
</blockquote>
<p><br>
</p>
<p>This issue is now reported as <a moz-do-not-send="true"
href="http://bugzilla.scilab.org/show_bug.cgi?id=16254">bug
16250</a>.</p>
<p>Solving this issue would improve the converter.<br>
I may contribute to solve it. However, I do not use to use
Matlab or Octave. So i don't know how the ~ placeholder set in
the list of <i>inputs</i> is processed inside the called
function. This message is a call for information about this
topic.<br>
<br>
Ignoring an output is trivial. As suggested by Stéphane, the ans
variable is a good candidate as replacement for ~,<br>
just as a fake recipient, as in "[~, ia] = unique(A)" =>
"[ans, ia] = unique(A)"<br>
</p>
<p>The meaning of ignoring an input is a priori completely
different, at least from a Scilab point of view.<br>
</p>
<p>This leads to the fact that, on the "function ..." line, the
converter will have to distinguish the list of inputs from the
list of outputs, and then process the same ~ character in 2
different ways.<br>
This processing would have to run also when the "function ..."
line is split on several rows with the "..." continuation marks.<br>
<br>
First, i will need an actual example of function call with ~ in
the input list, runnable in Octave.<br>
Any compact suggestion is welcome.<br>
At least 2 use cases are expected: one calling a function
written in Octave/Matlab language (improperly called "macros" in
Scilab), the other one calling a hard-coded function.<br>
</p>
<p>Let's consider the first case, with a "macro":</p>
<ul>
<li>What does the ~ sent placeholder pass to the function? How
is it detected/detectable inside the macro ?</li>
<li>How is it processed by the function? Is there a generic
default processing, as replacing it with the empty matrix [],
or whatever else?</li>
</ul>
</blockquote>
<p>Where is the crowd of matlabers?</p>
The page describing this feature:
<a class="moz-txt-link-freetext" href="https://fr.mathworks.com/help/matlab/matlab_prog/ignore-function-inputs.html">https://fr.mathworks.com/help/matlab/matlab_prog/ignore-function-inputs.html</a><br>
But i do not clearly understand it.<br>
Apparently, "canceling" an input is done (only?) at the function
definition, not when calling it, unlike for the outputs.<br>
If so, then <i>ans</i> could also be used as a replacement, meaning
that anyway this input won't be used inside the function.<br>
<p>A test of call with Octave yields an error:</p>
<p><font size="-1"><tt>>> function [r, s] = funtest(a,b,c)</tt><tt><br>
</tt><tt>end</tt><tt><br>
</tt><tt>>> funtest(1,~,3)</tt><tt><br>
</tt><tt>parse error:</tt><tt><br>
</tt><tt> invalid use of empty argument (~) in index expression</tt><tt><br>
</tt><tt>>>> funtest(1,~,3)</tt><tt><br>
</tt><tt> ^</tt><tt><br>
</tt><tt>>></tt><tt><br>
</tt></font></p>
Any further insight is welcome.<br>
Samuel<br>
<br>
</body>
</html>