Re: Table Iterators
- To: mathgroup at smc.vnet.net
- Subject: [mg52635] Re: Table Iterators
- From: Peter Pein <petsie at arcor.de>
- Date: Sun, 5 Dec 2004 02:08:13 -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
>
In[1]:=
rowDim := {i, 1, 10, 3};
colDim := {j, 2, 8, 2};
Attributes[Table]
Table[stuff[i, j], Evaluate[rowDim], Evaluate[colDim]]
Out[3]=
{HoldAll, Protected}
(*^^^^^^^*)
Out[4]=
{{stuff[1, 2], stuff[1, 4], stuff[1, 6], stuff[1, 8]},
{stuff[4, 2], stuff[4, 4], stuff[4, 6], stuff[4, 8]},
{stuff[7, 2], stuff[7, 4], stuff[7, 6], stuff[7, 8]},
{stuff[10, 2], stuff[10, 4], stuff[10, 6], stuff[10, 8]}}
--
Peter Pein
10245 Berlin