Re: Dynamically create array and display data graphically

• To: mathgroup at smc.vnet.net
• Subject: [mg102537] Re: Dynamically create array and display data graphically
• From: pfalloon <pfalloon at gmail.com>
• Date: Wed, 12 Aug 2009 04:37:31 -0400 (EDT)
• References: <h5r8fv\$l9v\$1@smc.vnet.net>

```On Aug 11, 6:01 pm, Tuhina Singh <tuhina.si... at rmilindia.com> wrote:
> Hi,
> Please bear with me if you find this a simplistic problem. Just learning to find my way around mathematica.
>
> b = Import["C:\Practice\example1.xls",{"Data",1}]  (* Import file - several columns of data with first row having headers *)
>
> Manipulate[Manipulate[DateListPLot[{Take[b,{2,p}][[All,a]]}, {{2009,7,8},Automatic,"Day"},Joined->True],{p,2,35,1}],{a,2,5,1}]
>
> In this code, I am able to specify the column I want displayed using the outer manipulate fn, and the inner manipulate function changes the number of rows of data displayed.
>
> Now I want to change this function so that the outer manipulate fn specifies the "number of columns" to be displayed. So that if a = 3, I see three series in the graph with "p" rows of data shown in the graph.
>
> I tried the following with no success:
>
> Manipulate[{Do[col[[x]]= DateListPLot[{Take[b,{2,35}][[All,x]]}, {{2009,7,8},Automatic,"Day"},Joined->True, DisplayFunction->Identity],{x,2,a,1}],
> Do[Show[col[[x]], DisplayFunction->\$DisplayFunction],{x,2,a,1}]}, ,{a,2,5,1}]
>
> Was basically trying to loop  "a" times to dynamically create an array of dimension [a, 35] and then display them all together using Show function . But value of "a" doesn't get passed on and I believe use of the Do loop is also wrong here.
>
> Thanks for ur help.
>
> Regards,
> Tuhina
> ________________________________
> Tuhina Singh
> Siddhesh Capital Market Services Pvt Ltd.
> 122, Maker Chambers III, 12th Floor
> Nariman POint
> Mumbai - 400 021
>
> Tel (D): 91-22-4057 0322
>        (B): 91-22-4057 0300
>        Fax: 91-22-2285 2912

A couple of quick suggestions:

1. You shouldn't need to nest Manipulate like this -- rather, you can
include both variables (p,a) in the same call to Manipulate.

2. Unless you are using an old version (< 6) of Mathematica (which,
judging from the use of Manipulate isn't the case?), using Show inside
a Do loop won't work (IIRC there was a post on this recently that may
be helpful) -- instead you should use a Table. In the same way, the
use of DisplayFunction is no longer necessary.

Cheers,
Peter.

```

• Prev by Date: Re: Re: Re: Highlighting data sections with a
• Next by Date: Re: video on Presentations by Williams and Park
• Previous by thread: Re: Re: Dynamically create array and display data
• Next by thread: Re: Dynamically create array and display data graphically