Re: Re: PutAppend Command and Data Output

*To*: mathgroup at smc.vnet.net*Subject*: [mg49825] Re: [mg49762] Re: [mg49695] PutAppend Command and Data Output*From*: DrBob <drbob at bigfoot.com>*Date*: Tue, 3 Aug 2004 01:10:56 -0400 (EDT)*References*: <BAY22-F15zUSxvjPkQT0001218e@hotmail.com>*Reply-to*: drbob at bigfoot.com*Sender*: owner-wri-mathgroup at wolfram.com

It doesn't matter how the data you're exporting gets its value; what matters is the value, including its structure. If it's being exported with too many brackets, it's because the data has too many brackets. Having never seen how you get that data value assigned (in detail, so that we can duplicate it), I can only guess what you've done wrong. NDSolve typically returns a List of solutions, each of them a List of Rules. That's already too many brackets for a lot of applications, so pay attention to how you extract your solutions. Bobby On Mon, 02 Aug 2004 09:29:12 -0500, Daniel Kramer <boydkramer at hotmail.com> wrote: > Using "Evaluate" to generate my end values from a series of differential > equations and "NDSolve", I still get a 2 by 3 matrix in a .dat, .txt, or a > .csv file when using the code you provided. If I arbitrarily assign values, > as you did, I can get a 1 x 6 row vector to export to a spreadsheet file as > I would like. I am not too concerned about the text headers since this is > easy to do, but I still would like to export these values in a 1 x 6 row > vector to an excel spreadsheet. This shouldn't be so difficult. > > Daniel Kramer > > > > >> From: DrBob <drbob at bigfoot.com> To: mathgroup at smc.vnet.net >> Reply-To: drbob at bigfoot.com >> To: mathgroup at smc.vnet.net >> Subject: [mg49825] [mg49762] Re: [mg49695] PutAppend Command and Data Output >> Date: Fri, 30 Jul 2004 06:02:15 -0400 (EDT) >> >> In the first set of code, I've duplicated your resulting file (I think). >> The result isn't a 2x3 matrix at all. The brackets are there because hend, >> pend, ... are lists (because of the way you defined them). >> >> Clear[hend,pend,shend,spend,aend,cend] >> values={hend,pend,shend,spend,aend,cend}; >> names=ToString/@values; >> data={{84.44222381154862}, {17.295098646610068}, {0.9999464544412083} \ >> ,{0.00005354555879104163} ,{0.6314412255157023} ,{0.16406999044034634}}; >> Put[names,"output.csv"]; >> {hend,pend,shend,spend,aend,cend}=data; >> PutAppend[values,"output.csv"]; >> ReadList["output.csv"] >> >> {{hend,pend,shend,spend,aend,cend},{{84.4422},{17.2951},{ >> 0.999946},{0.0000535456},{0.631441},{0.16407}}} >> >> In this version, Flatten eliminates the brackets: >> >> Clear[hend,pend,shend,spend,aend,cend] >> values={hend,pend,shend,spend,aend,cend}; >> names=ToString/@values; >> Put[names,"output.csv"]; >> {hend,pend,shend,spend,aend,cend}=Flatten@data; >> PutAppend[values,"output.csv"]; >> ReadList["output.csv"] >> >> {{hend,pend,shend,spend,aend,cend},{ >> 84.4422,17.2951,0.999946,0.0000535456,0.631441,0.16407}} >> >> Flatten@data could be replaced by First/@data, or the definition of each >> variable could include First, as in hend=h[time]/.First@sol or >> hend=First[h[time]/.sol. >> >> Bobby >> >> >> On Thu, 29 Jul 2004 07:43:02 -0400 (EDT), Daniel Kramer >> <boydkramer at hotmail.com> wrote: >> >> > There should be a simple solution to this problem, but I am stumped. >> > Wolfram support is unhelpful as well. I am running a simulation model >> with >> > six differential equations. I would like to store the ending values for >> > these six variables in spreadsheet form as I perform sensitivity >> analyses on >> > the parameter values. So I define the ending values for my variables... >> > >> > hend=Evaluate[h[time]/.sol; >> > pend=Evaluate[p[time]/.sol; >> > shend=Evaluate[sh[time]/.sol; >> > spend=Evaluate[sp[time]/.sol; >> > aend=Evaluate[a[time]/.sol; >> > cend=Evaluate[c[time]/.sol; >> > >> > I then append these values to an existing spreadsheet file. The problem >> is >> > that the ending values are always added to my file in a 2 by 3 matrix >> > instead of a 1 by 6 row matrix. See the Ã¢â?¬Å?PutAppendÃ¢â?¬ï¿½ command line >> below and >> > the output. I have tried putting the output in a 6 by 1 column matrix >> and >> > this works by using the following in my PutAppend command - >> > {{hend},{pend},{shend},{spend},{aend},{cend}}. This works fine but data >> is >> > appended down the spreadsheet instead of in columns which is as >> cumbersome >> > as my original problem. The other minor problem is the brackets in my >> > output. I wish they werenÃ¢â?¬â?¢t there. Perhaps these two problems are >> related? >> > Are the values in a form that Excel has trouble reading? I would >> greatly >> > appreciate anyoneÃ¢â?¬â?¢s help. >> > >> > PutAppend[{hend,pend,shend,spend,aend,cend},Ã¢â?¬ï¿½output.csvÃ¢â?¬ï¿½] >> > >> > hend pend shend spend aend cend >> > {{84.44222381154862} {17.295098646610068} {0.9999464544412083} >> > {0.00005354555879104163} {0.6314412255157023} {0.16406999044034634}} >> > >> > >> > By the way, if I add the following line as a test, it works perfectly, >> > adding a 1 by 6 row vector to the spreadsheet file. >> > >> > PutAppend[{1,2,3,4,5,6},Ã¢â?¬ï¿½output.csvÃ¢â?¬ï¿½] >> > >> > Daniel Kramer >> > >> > _________________________________________________________________ >> > Overwhelmed by debt? Find out how to Ã¢â?¬Ë?Dig Yourself Out of DebtÃ¢â?¬â?¢ from >> MSN >> > Money. http://special.msn.com/money/0407debt.armx >> > >> > >> > >> >> >> >> -- >> DrBob at bigfoot.com >> www.eclecticdreams.net >> > > _________________________________________________________________ > Planning a family vacation? Check out the MSN Family Travel guide! > http://dollar.msn.com > > > -- DrBob at bigfoot.com www.eclecticdreams.net

**Re: Re: PutAppend Command and Data Output**

**Re: envelope of an oscillatory InterpolatingFunction**

**Re: Re: PutAppend Command and Data Output**

**Forcing Argument Evaluation**