<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<div>
<p dir="auto" style="text-align:left; margin-top:25px; margin-bottom:25px; font-family:sans-serif; font-size:11pt; color:black; background-color:white">
Hi,<br>
I would have also written </p>
<p dir="auto" style="text-align:left; margin-top:25px; margin-bottom:25px; font-family:sans-serif; font-size:11pt; color:black; background-color:white">
SumArr = [SumArr toAdd]</p>
<p dir="auto" style="text-align:left; margin-top:25px; margin-bottom:25px; font-family:sans-serif; font-size:11pt; color:black; background-color:white">
Why is this answer different to the original?</p>
<p dir="auto" style="text-align:left; margin-top:25px; margin-bottom:25px; font-family:sans-serif; font-size:11pt; color:black; background-color:white">
SumArr( (length(SumArr)+1) : (length(SumArr)+length(toAdd)) ) = toAdd;</p>
<p dir="auto" style="text-align:left; margin-top:25px; margin-bottom:25px; font-family:sans-serif; font-size:11pt; color:black; background-color:white">
May be im missing something, but i think in both cases you need to know the arrays in advance, dont you?</p>
<p dir="auto" style="text-align:left; margin-top:25px; margin-bottom:25px; font-family:sans-serif; font-size:11pt; color:black; background-color:white">
Also, i think  SumArr = [SumArr toAdd] has better performance...<br>
Perhaps im not understanding the question..</p>
<p dir="auto" style="text-align:left; margin-top:25px; margin-bottom:25px; font-family:sans-serif; font-size:11pt; color:black; background-color:white">
</p>
<p dir="auto" style="text-align:left; margin-top:25px; margin-bottom:25px; font-family:sans-serif; font-size:11pt; color:black; background-color:white">
Obtener <a href="https://aka.ms/ghei36">Outlook para Android</a></p>
<br>
<p></p>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> users <users-bounces@lists.scilab.org> on behalf of Tim Wescott <tim@wescottdesign.com><br>
<b>Sent:</b> Wednesday, March 22, 2017 8:50:26 PM<br>
<b>To:</b> Users mailing list for Scilab<br>
<b>Subject:</b> Re: [Scilab-users] add number arrays efficiently, how?</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText">On Thu, 2017-03-23 at 00:28 +0100, Samuel Gougeon wrote:<br>
> Le 22/03/2017 à 23:15, Erhy a écrit :<br>
> > <br>
> > Hello!<br>
> > I'm thinking in arrays - and I write<br>
> > <br>
> > SumArr = [ 1 2 3 ];  toAdd = [ 7 8 9 10 ];<br>
> > SumArr( (length(SumArr)+1) : (length(SumArr)+length(toAdd)) ) =<br>
> > toAdd;<br>
> > <br>
> > How to code it smarter?<br>
> SumArr = [SumArr toAdd]<br>
> <br>
<br>
If you know them in advance, yes.  My answer was predicated on not<br>
knowing "toAdd" at the same time as the 1x3 SumArr.<br>
<br>
> -- <br>
<br>
Tim Wescott<br>
<a href="http://www.wescottdesign.com">www.wescottdesign.com</a><br>
Control & Communications systems, circuit & software design.<br>
Phone: 503.631.7815<br>
Cell:  503.349.8432<br>
<br>
<br>
<br>
_______________________________________________<br>
users mailing list<br>
users@lists.scilab.org<br>
<a href="http://lists.scilab.org/mailman/listinfo/users">http://lists.scilab.org/mailman/listinfo/users</a><br>
</div>
</span></font>
</body>
</html>