Re: fast way of appending x zeros to a list?
- To: mathgroup at smc.vnet.net
- Subject: [mg79132] Re: fast way of appending x zeros to a list?
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Thu, 19 Jul 2007 03:34:38 -0400 (EDT)
- References: <f7ke8n$508$1@smc.vnet.net>
Hi,
data=Join[data,Table[0,{K}]]
??
Regards
Jens
kristoph wrote:
> Dear all,
>
> I'm looking for a fast way to append 0's to a list. Unfortunately, I
> append a variable number of 0's to a list which is generated by a
> For[...]-loop. Therefore, PadLeft[...] is not variable enough to
> append exactly x zeros to the list.
>
> At the moment I use: Do[PrependTo[data,0],{K}] where the K depends on
> certain factors.
>
> In case you have an idea to append exactly x zeros to the left quickly
> I would be more that happy since I heard that the PrependTo[...] and
> AppendTo[...] functions are very slow.
>
> Thanks a lot.
>
>