Re: Substitution in BinLists
- To: mathgroup at smc.vnet.net
- Subject: [mg41446] Re: Substitution in BinLists
- From: Mark Westwood <mark at galeawestwood.freeserve.co.uk>
- Date: Tue, 20 May 2003 03:24:28 -0400 (EDT)
- References: <baa7q3$jpu$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Mark
Try
{{1},{2},{3},{4},{},{},{},{},{},{10}}/.{}->{0}
on my machine I get the output
{{1}, {2}, {3}, {4}, {0}, {0}, {0}, {0}, {0}, {10}}
I'm running Mathematic 4.2.1
Hope this helps - for further info look under Replace in the Help Browser
Regards
Mark Westwood
Mark E. Berres wrote:
> Hi,
> I'm trying to substitute a zero (0) for bins that are empty when using
> BinLists:
>
> In[192]:= <<Statistics`DataManipulation`
> In[193]:= a={1,2,3,4,10};
> In[194]:= BinLists[a,{0,10,1}]
>
> Out[194]:= {{1},{2},{3},{4},{},{},{},{},{},{10}}
>
> What I would like output is {1,2,3,4,0,0,0,0,0,10}.
> Flatten nearly gets me there but omits the empty bins {}: {1,2,3,4,10}.
>
> Thanks
> -Mark
>
>
>