<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<div class="moz-cite-prefix">Le 18/02/2021 à 19:34, Federico Miyara
a écrit :<br>
</div>
<blockquote type="cite"
cite="mid:74b8f5a5-693c-86be-0045-293bf5393f4c@fceia.unr.edu.ar">
<br>
<font face="Courier New">Dear All,<br>
<br>
Is there a Scilab function to convert a vector to a list?<br>
<br>
If x is a vector, this code <br>
<br>
L = list();<br>
for n=1:length(x)<br>
L(n) = x(n);<br>
end<br>
<br>
seems to work, but it would be nice to have a primitive doing
this more efficiently. I don't seem to be able to find it.<br>
</font></blockquote>
<p><br>
</p>
<p><font face="Courier New">vec2list() is a macro instead of a
built-in, but it aims to do the job:</font></p>
<p><font face="Courier New">--> n = 3;<br>
--> v = rand(1,n)<br>
v = <br>
0.2113249 0.7560439 0.0002211<br>
<br>
--> vec2list(v,ones(n,2))<br>
</font><font face="Courier New"><font face="Courier New"> ans =<br>
</font> (1) = 0.2113249<br>
(2) = 0.7560439<br>
(3) = 0.0002211</font></p>
<p><a class="moz-txt-link-freetext"
href="https://help.scilab.org/docs/6.1.0/en_US/vec2list.html">https://help.scilab.org/docs/6.1.0/en_US/vec2list.html</a><br>
</p>
<p>Samuel<br>
<br>
</p>
</body>
</html>