|
[Date Index]
[Thread Index]
[Author Index]
Re: Partitioning 1-D list into 2-D Matrix
- To: mathgroup at smc.vnet.net
- Subject: [mg29792] Re: Partitioning 1-D list into 2-D Matrix
- From: "Orestis Vantzos" <atelesforos at hotmail.com>
- Date: Tue, 10 Jul 2001 20:25:30 -0400 (EDT)
- Organization: National Technical University of Athens, Greece
- References: <9i6ao4$ol6$1@smc.vnet.net> <9iaues$17m$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Sorry everybody. Didn't pay close attention to the requested matrix!
Won't do it again...
Orestis
"Orestis Vantzos" <atelesforos at hotmail.com> wrote in message
news:9iaues$17m$1 at smc.vnet.net...
> Why use Partition 2 times!?!
> Partition[b,5] returns the matrix you want.
> Generaly a single application of Partition to a vector will return a
> (rectangular) matrix. As a second argument to Partition you can supply any
> divisor of the Length of the vector.
> Orestis
>
>
> "Krautschik, Chris G" <krautschikc at intel.co.jp>
> >
> > b=Range[1,20]
> > {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}
> >
> > I would like to arrange the list into a 2D array of the following form:
> > {{1, 3, 5, 7, 9}, {2, 4, 6, 8, 10}, {11, 13, 15, 17, 19}, {12, 14, 16,
18,
> > 20}}
> >
> > Then
> > bb=Partition[Partition[b,2],5]
> > <<...OLE_Obj...>>
> > almost does what I want if you view this array in MatrixForm[]. However,
I
> > would have to somehow get rid of the innner brackets. I am not sure how
to
> > do that with Flatten[].
> >
> > I could use brute force and select the elements as follows:
> > <<...OLE_Obj...>>
> > <<...OLE_Obj...>>
> >
> > I have a feeling there is a much better way to do this.
> >
> > Thanks in advance,
> > Chris
> >
> >
>
>
>
Prev by Date:
Fitting multiple nonlinear equations to unequal length datasets
Next by Date:
Re: Mathematica and Scientific Workplace
Previous by thread:
Re: Partitioning 1-D list into 2-D Matrix
Next by thread:
Math Fonts in EPS-exported graphs
|