<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/05/2019 à 09:34, Dang Ngoc Chan,
Christophe a écrit :<br>
</div>
<blockquote type="cite"
cite="mid:DB6PR07MB4344E5B141E4C02060678C1EE5010@DB6PR07MB4344.eurprd07.prod.outlook.com">
<pre class="moz-quote-pre" wrap="">Hello,
</pre>
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">De : Carrico, Paul
Envoyé : jeudi 23 mai 2019 09:21
I share your suggestion in adding an example in the doc to prevent Scilab
users, but the question is "where" ?
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">
I suggest the "Scilab Help >> Elementary Functions > extraction" page.</pre>
</blockquote>
<p>I am not sure that is the right place. In fact our discussion is
about the general concepts of <b>lvalue</b> and <b>rvalue</b>
(in most languages, compiled or interpreted, see e.g. <a
href="https://www.quora.com/What-is-lvalue-and-rvalue-in-C">https://www.quora.com/What-is-lvalue-and-rvalue-in-C</a>
which starts with general stuff valuable for Scilab also)<br>
</p>
<p>In this insertion expression:<br>
</p>
<p>x(i) = y<br>
</p>
<p>x(i) determines the identity of an object, and we need this
because the evaluation of the expression will modify it . In this
case "x(i)" is a <b>lvalue</b>. The "l" is to recall that such
constructs are to the <b>left</b> of the assignment operator</p>
<p>In this extraction expression:<br>
</p>
<p>y = x(i)</p>
<p>"x(i)" is a <b>rvalue</b>, i.e. a "result" which is <u>temporary</u>
materialized, and identity of x is lost (because we don't need
it). Here the "r" can be seen as "right" as well as "result" (I
prefer "result"...)<br>
</p>
<p>Hence, in the expressions</p>
<p>x=rand(10,1);<br>
[v,k]=find(x(3:10))</p>
<p>find() just sees an anonymous/temporary 8x1 vector. It is the
user's responsibility to do <br>
</p>
<p>k=k+2</p>
<p>to compute the actual index in original vector. <br>
</p>
<p>S.<br>
</p>
<blockquote type="cite"
cite="mid:DB6PR07MB4344E5B141E4C02060678C1EE5010@DB6PR07MB4344.eurprd07.prod.outlook.com">
<pre class="moz-quote-pre" wrap="">
Regards
--
Christophe Dang Ngoc Chan
Mechanical calculation engineer
General
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error), please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
_______________________________________________
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/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users">https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users</a>
</pre>
</blockquote>
<p><br>
</p>
<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>