Re: need to call data from a list as input but need it in vector form not list form

• To: mathgroup at smc.vnet.net
• Subject: [mg50680] Re: [mg50648] need to call data from a list as input but need it in vector form not list form
• From: Sseziwa Mukasa <mukasa at jeol.com>
• Date: Fri, 17 Sep 2004 01:15:44 -0400 (EDT)
• References: <200409150550.BAA11792@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```On Sep 15, 2004, at 1:50 AM, T. wrote:

> Suppose I have just generated a list named "list" and the output is as
> follows.
>
> {{0.161299}, {0.122965}, {0.055712}, {0.0448334}, {-0.00538706}}
>
> I want to use this data in the form
>
> {0.161299, 0.122965, 0.055712, 0.0448334, -0.00538706}
>
> however i can't call it in with list[[i]] because I just get the
> {{},{},{},{}} form with those extra brackets.

Use Flatten[list] or list[[All,1]].

>   I guess I have a list
> and I am trying to convert it to a vector form right?  Sorry if my
> definitions are confused.

One way of specifying your problem is you have a rank 2 list and you
want a rank 1 list, or you have a matrix and you want a vector in row
(or column in this case they're the same thing) major order.  At any
rate a list in Mathematica is any expression with the head List,
regardless of its structure.  What you are concerned about is the
structure of a list, in which case you can refer to its rank in the
case that it makes sense to think of it as a vector, matrix or other
form of tensor.  If you don't have a regular structure such a list of
the form {{},{{}},{{{}}},{}} then you can refer to its depth or tree
form.  In either case, Flatten and Partition are usually the functions
used to modify a list's structure.  Incidentally they work on
expressions that don't have the head List.  I hope this helps.

Regards,

Ssezi

```

• Prev by Date: Re: GuiKit & GraphEdit
• Next by Date: Re: Plot[f, {x,a,b] vs Plot[{f},[x,a,b]
• Previous by thread: need to call data from a list as input but need it in vector form not list form
• Next by thread: Primed Variables in Mathematica