<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 21/01/2020 à 00:54, Federico Miyara
a écrit :<br>
</div>
<blockquote type="cite"
cite="mid:e32c2933-49cf-53ba-31ca-bdf9b94e32a5@fceia.unr.edu.ar">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<br>
<font face="Courier New">Samuel,<br>
<br>
Thanks VERY much!<br>
<br>
It certainly does the job, but I don't quite understand how. For
example, to retrieve the last columns of all dimensions: <br>
<br>
<br>
A = matrix(1:120, </font><font face="Courier New">[5,4,2 3]</font><font
face="Courier New">);<br>
<br>
L = list();<br>
for i=1:length(size(A))<br>
L($+1) = 1:size(A)(i);<br>
end<br>
<br>
L(2) = size(A)(2);<br>
</font></blockquote>
<p><br>
</p>
<p><font face="Courier New">// or<br>
L = list();<br>
</font><font face="Courier New">for i = 1:ndims(A)<br>
L($+1) = :;<br>
end<br>
</font><font face="Courier New">L(2) = $;<br>
</font>
</p>
<p><br>
</p>
<blockquote type="cite"
cite="mid:e32c2933-49cf-53ba-31ca-bdf9b94e32a5@fceia.unr.edu.ar"><font
face="Courier New"> <br>
B = A(L(:));<br>
<br>
B is exactly the desiredresult. But when I try to see what is
L(:) I get<br>
<br>
--> L(:)<br>
ans =<br>
<br>
1. 2. 3. 4. 5.<br>
</font></blockquote>
<p><br>
</p>
<p>Yes, it's a bit tricky: L(:) extracts all L components, but there
is no LHS recipient except the invisible ans. Then, only ans is
assigned, to L(1). Other L(2:$) are ignored.</p>
<p><font face="Courier New"><br>
</font></p>
<blockquote type="cite"
cite="mid:e32c2933-49cf-53ba-31ca-bdf9b94e32a5@fceia.unr.edu.ar"><font
face="Courier New"> .../...<br>
<br>
If I try to assign L(:) to a variable I get<br>
<br>
--> u=L(:)<br>
<br>
Can not assign multiple value in a single variable<br>
</font></blockquote>
<p><br>
</p>
<p>This is somewhat reported here: <a class="moz-txt-link-freetext" href="http://bugzilla.scilab.org/14372">http://bugzilla.scilab.org/14372</a></p>
<p><br>
</p>
<blockquote type="cite"
cite="mid:e32c2933-49cf-53ba-31ca-bdf9b94e32a5@fceia.unr.edu.ar"><font
face="Courier New"> <br>
So I attempt<br>
<br>
--> [u1,u2,u3,u4] = L(:)<br>
<br>
and get<br>
<br>
<br>
u4 = <br>
<br>
1. 2. 3.<br>
u3 = <br>
<br>
1. 2.<br>
u2 = <br>
<br>
4.<br>
u1 = <br>
<br>
1. 2. 3. 4. 5.<br>
</font></blockquote>
<p><br>
</p>
<p>This is described on
<a class="moz-txt-link-freetext" href="https://help.scilab.org/docs/6.0.2/en_US/brackets.html">https://help.scilab.org/docs/6.0.2/en_US/brackets.html</a></p>
<p><br>
</p>
<blockquote type="cite"
cite="mid:e32c2933-49cf-53ba-31ca-bdf9b94e32a5@fceia.unr.edu.ar"><font
face="Courier New"> <br>
../..<br>
<br>
I would like to understand what's going on.<br>
</font></blockquote>
<p><br>
</p>
<p><font face="Courier New">(a,b,c) is the smart Scilab "deal()"
operator:</font></p>
<p><font face="Courier New">[a, b, c] = (3, 1, -2)</font></p>
<p><tt>--> [a, b, c] = (3, "Hi", -2)</tt><tt><br>
</tt><tt> a = </tt><tt><br>
</tt><tt> 3</tt><tt>.<br>
</tt><tt><br>
b = </tt><tt><br>
</tt><tt> Hi</tt><tt><br>
</tt><tt><br>
c = </tt><tt><br>
</tt><tt> -2<br>
</tt></p>
<p>Regards<br>
Samuel</p>
<p><br>
</p>
</body>
</html>