Hi, I would have also written SumArr = [SumArr toAdd]
Why is this answer different to the original? SumArr( (length(SumArr)+1) : (length(SumArr)+length(toAdd)) ) = toAdd; May be im missing something, but i think in both cases you need to know the arrays in advance, dont you? Also, i think SumArr = [SumArr toAdd] has better performance... Perhaps im not understanding the question.. Obtener Outlook para Android<https://aka.ms/ghei36> ________________________________ From: users <users-boun...@lists.scilab.org> on behalf of Tim Wescott <t...@wescottdesign.com> Sent: Wednesday, March 22, 2017 8:50:26 PM To: Users mailing list for Scilab Subject: Re: [Scilab-users] add number arrays efficiently, how? On Thu, 2017-03-23 at 00:28 +0100, Samuel Gougeon wrote: > Le 22/03/2017 à 23:15, Erhy a écrit : > > > > Hello! > > I'm thinking in arrays - and I write > > > > SumArr = [ 1 2 3 ]; toAdd = [ 7 8 9 10 ]; > > SumArr( (length(SumArr)+1) : (length(SumArr)+length(toAdd)) ) = > > toAdd; > > > > How to code it smarter? > SumArr = [SumArr toAdd] > If you know them in advance, yes. My answer was predicated on not knowing "toAdd" at the same time as the 1x3 SumArr. > -- Tim Wescott www.wescottdesign.com<http://www.wescottdesign.com> Control & Communications systems, circuit & software design. Phone: 503.631.7815 Cell: 503.349.8432 _______________________________________________ users mailing list users@lists.scilab.org http://lists.scilab.org/mailman/listinfo/users
_______________________________________________ users mailing list users@lists.scilab.org http://lists.scilab.org/mailman/listinfo/users