<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Le 24/04/2019 à 10:07, Samuel Gougeon a
écrit :<br>
</div>
<blockquote cite="mid:23778568-ba07-037f-dcf1-8ebca9e7af5b@free.fr"
type="cite">
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
<tt><font size="-1">.../...</font></tt><br>
<br>
For the general discussion, i think that, from a user's point a
view, when using a container as LHS argument, a distributive
assignment would be <b>often</b> very useful. It might be either
through a new <b>.=</b> "operator", or through the classic "="
one but only when for instance the RHS is a container as well,<br>
<ul>
<li>either a list with the right number of elements at depth = 0</li>
<li>or a cell or struct array with the same sizes as the cell or
struct (or struct or cell) on the LHS</li>
</ul>
<p>AFAIR, this kind of feature is already reported as a wish.</p>
</blockquote>
<br>
By the way, while it was possible in Scilab 5.5.2 to assign the
elements of a list to all elements of the field of an array of
structures, it is no longer the case in Scilab 6.0:<br>
<br>
<font size="-1"><tt>--> clear s</tt><tt><br>
</tt><tt>--> s.a = %pi;</tt><tt><br>
</tt><tt>--> s.b = "a";</tt><tt><br>
</tt><tt>--> s(2).a = %e;</tt><tt><br>
</tt><tt>--> s(2).b = "b"</tt><tt><br>
</tt><tt> s = </tt><tt><br>
</tt><tt>2x1 struct array with fields:</tt><tt><br>
</tt><tt> a</tt><tt><br>
</tt><tt> b</tt><tt><br>
</tt><tt><br>
</tt><tt>--> setfield("a", list(%i, 3.1), s)</tt><tt><br>
</tt><tt>setfield: Wrong type for input argument #3: List
expected.</tt><tt><br>
</tt></font><br>
In Scilab 5, we get the right assignment:<br>
<br>
<font size="-1"><tt>-->setfield("a",list(%i,3.1),s)</tt><tt><br>
</tt><tt>-->s.a</tt><tt><br>
</tt><tt> ans =</tt><tt><br>
</tt><tt> ans(1)</tt><tt><br>
</tt><tt> i </tt><tt><br>
</tt><tt> ans(2)</tt><tt><br>
</tt><tt> 3.1 </tt><tt><br>
-->s(2).a<br>
ans = <br>
3.1 <br>
</tt></font><br>
This Scilab 6 restriction weakens the usage of arrays of structures.<br>
<br>
Samuel<br>
<br>
</body>
</html>