Re: making a column into a list
- To: mathgroup at smc.vnet.net
- Subject: [mg22972] Re: [mg22964] making a column into a list
- From: "Mark Harder" <harderm at ucs.orst.edu>
- Date: Sat, 8 Apr 2000 14:44:43 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Sipai,
I didn't get your attatchment, so let me try some guesses:
To get a column from a matrix in list form:
IN>
matrix = {{1, 2}, {1, 2}, {1, 2}}
column = Column[matrix, 1]
OUT>
{{1, 2}, {1, 2}, {1, 2}}
{1, 1, 1}
To create a list from nested lists, use Flatten[]:
IN>
columnVec = {{1}, {2}, {3}}
list = Flatten[columnVec ]
Out[268]={{1}, {2}, {3}}
Out[269]={1, 2, 3}
To create a list of x,y pairs (eg. for ListPlot[]) from separate x & y
lists, I use the following:
IN>
x = {1, 2, 3};
y = {4, 8, 12};
pairs = Transpose[{x, y} ]
OUT>
{{1, 4}, {2, 8}, {3, 12}}
-mark harder
-----Original Message-----
From: Ruchi5ten at aol.com <Ruchi5ten at aol.com>
To: mathgroup at smc.vnet.net
Subject: [mg22972] [mg22964] making a column into a list
>in and attempt to create a plot or use graphics i need to generate a list;
>but usually what comes is a column of results from using the DO comand. i
>don't know how to form a list (instead of column) using a function with has
>the capability of the repetiton of the DO command.
>
>thank you for your time
>sipai
>
>ps
>in case i'm not clear i sent an attached program file
>