[Scilab-Dev] list as output in function call
Samuel Gougeon
sgougeon at free.fr
Wed Apr 24 10:36:57 CEST 2019
Le 24/04/2019 à 10:07, Samuel Gougeon a écrit :
> .../...
>
> 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 *often* very useful. It might be either through a new *.=*
> "operator", or through the classic "=" one but only when for instance
> the RHS is a container as well,
>
> * either a list with the right number of elements at depth = 0
> * or a cell or struct array with the same sizes as the cell or
> struct (or struct or cell) on the LHS
>
> AFAIR, this kind of feature is already reported as a wish.
>
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:
--> clear s
--> s.a = %pi;
--> s.b = "a";
--> s(2).a = %e;
--> s(2).b = "b"
s =
2x1 struct array with fields:
a
b
--> setfield("a", list(%i, 3.1), s)
setfield: Wrong type for input argument #3: List expected.
In Scilab 5, we get the right assignment:
-->setfield("a",list(%i,3.1),s)
-->s.a
ans =
ans(1)
i
ans(2)
3.1
-->s(2).a
ans =
3.1
This Scilab 6 restriction weakens the usage of arrays of structures.
Samuel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/dev/attachments/20190424/9b950f27/attachment.htm>
More information about the dev
mailing list