Message Boards Message Boards

0
|
7215 Views
|
1 Reply
|
0 Total Likes
View groups...
Share
Share this post:

AppendColumns replaced the FlattenArray & Join

Can someone please give me an example of how to replace AppendColumn with whatever it is replaced with.  I looked at the documentation for both FlattenArray and Join but did not see anything concerning AppendColumns.  My attempt to use the AppendRows example didn't work (i.e. 
http://reference.wolfram.com/mathematica/Compatibility/tutorial/LinearAlgebra/Files/MatrixManipulation.en/legacy_1.gif )

In my above attempt I am just guessing that the problem was related to some simple list manipulation rule.  I am a statistician and have been using SAS & R for many years so  my brain thinks all math software processes a matrix of information row-wise.

Thanks,

Steve
POSTED BY: Steven Anderson
A couple of ways to append the column col to mat.
 In[1]:= mat = Partition[Range[12], 4]
 
 Out[1]= {{1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 11, 12}}
 
 In[2]:= col = {1, 1, 1};
 
 In[3]:= Transpose[Join[Transpose[mat], {col}]]
 
 Out[3]= {{1, 2, 3, 4, 1}, {5, 6, 7, 8, 1}, {9, 10, 11, 12, 1}}

In[4]:= Join[mat, List /@ col, 2]

Out[4]= {{1, 2, 3, 4, 1}, {5, 6, 7, 8, 1}, {9, 10, 11, 12, 1}}
POSTED BY: Ilian Gachevski
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract