Re: fast way of appending x zeros to a list?
- To: mathgroup at smc.vnet.net
- Subject: [mg79109] Re: [mg79090] fast way of appending x zeros to a list?
- From: Sseziwa Mukasa <mukasa at jeol.com>
- Date: Thu, 19 Jul 2007 03:22:43 -0400 (EDT)
- References: <200707180658.CAA04531@smc.vnet.net>
On Jul 18, 2007, at 2:58 AM, 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.
I'm not sure I understand what your problem is, if you know K then
PadLeft[data,Length[data]+K]
is equivalent to your Do loop.
Regards,
Ssezi
- References:
- fast way of appending x zeros to a list?
- From: kristoph <kristophs.post@web.de>
- fast way of appending x zeros to a list?