Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'questin about AppendTo' topicStudent Support Forum > General > "questin about AppendTo"

Next Comment >Help | Reply To Topic
Author Comment/Response
Hyun
08/23/07 3:15pm

I have a question about AppendTo.

For example, I have 4 outputs.
Out[1]= {8, 1}
Out[2]= {3, 4}
Out[3]= {5, 2}
Out[4]= {7, 0}

I want to make this data by row.
{{8, 1},{3, 4},{5, 2},{7, 0}}

I did this step by step by using AppendTo

X1results = {}
AppendTo[X1results, Out[1]]
{{8, 1}}
AppendTo[X1results, Out[2]]
{{8, 1}, {3, 4}}
AppendTo[X1results, Out[3]]
{{8, 1}, {3, 4}, {5, 2}}
AppendTo[X1results, Out[4]]
{{8, 1}, {3, 4}, {5, 2}, {7, 0}}


I want to do it at one time by using Do command.
But I couldn't do it.

Do[
n++
n = n + 1;
X1results = {}
AppendTo[X1results, Out[n]]
, {n, 1, 3}
]

Set::write: Tag Times in 1 2 is Protected. >>
Thread::tdlen: Objects of unequal length in {} {{7,0},{3,4}} cannot \
be combined. >>
Set::write: Tag Times in 2 3 is Protected. >>
Thread::tdlen: Objects of unequal length in {} {{7,0},{3,4}} {5,2} \
cannot be combined. >>
Thread::tdlen: Objects of unequal length in {} {} {5,2} {{7,0},{3,4}} \
cannot be combined. >>
General::stop: Further output of Thread::tdlen will be suppressed \
during this calculation. >>
Set::write: Tag Times in 3 4 is Protected. >>
General::stop: Further output of Set::write will be suppressed during \
this calculation. >>


Please help me.
I want to make {{8, 1}, {3, 4}, {5, 2}, {7, 0}} at one time by using some command.




Attachment: Question about.nb, URL: ,

Subject (listing for 'questin about AppendTo')
Author Date Posted
questin about AppendTo Hyun 08/23/07 3:15pm
Re: questin about AppendTo Forum Modera... 08/24/07 1:41pm
Re: questin about AppendTo S. Saralamba 08/26/07 8:39pm
Next Comment >Help | Reply To Topic