Re: Table Iterators
- To: mathgroup at smc.vnet.net
- Subject: [mg52634] Re: Table Iterators
- From: David Bailey <dave at Remove_Thisdbailey.co.uk>
- Date: Sun, 5 Dec 2004 02:08:12 -0500 (EST)
- References: <cos193$dm8$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Gregory Lypny wrote:
> Hello Everyone,
>
> I need to create many tables, all with the same iterators {i, iMin,
> iMax, di}, {j, jMin, jMax, dj}. I'd like to be able to set the
> iterators outside of the Table function so that I can change them and
> have all of the tables change accordingly.
>
> I've tried
>
> rowDim:= {i, iMin, iMax, di} and colDim:={j, jMin, jMax, dj} inside of
> Table[stuff,rowDim,colDim]
>
> but this generates an iterator error.
>
> Any suggestions would be most appreciated.
>
> Greg
>
Hi,
You can do this with the 'With' operation:
myiterator = {i, 1, 10};
With[{myiterator = myiterator}, Table[f[i], myiterator]]
Take care to ensure your iteration variable is not defined outside this
operation!
David Bailey