Message Boards Message Boards

Organize data in table and adding column to data

Posted 9 years ago

Hi guys I would like to get a help organizing my data in table. The attached file is from my Kinetic class. My goals is to organize the data in columns and add new column. I want add 2 new columns: lnK and 1/T ( Arrhenius Equation), and plot lnk vs. 1/T. But I don't know how to process. I could have done this easily in excel, but my goal is to get used to Mathematica. Please help me on how to do this in the easiest way. Thank everyone!

Attachments:
POSTED BY: Dodji Cohovi
2 Replies

One way is to transpose the matrix, Insert the new column (as a simple list), and transpose back:

mat = {{a, b}, {1, 2}};
newColumn = {x, y};
positionWhereToInsert = 2;
Insert[Transpose[mat], newColumn, positionWhereToInsert] // Transpose

I would be glad to learn about a more elegant method.

POSTED BY: Gianluca Gorni
Posted 9 years ago

If one needs to add a column to a matrix as the first or the last column, here is more elegant method:

array = {{a, 1, 2}, {b, 2, 3}, {c, 3, 4}};
column = {x, y, z};

(* insert as the first column *)
Join[List /@ column, array, 2]
(* insert as the last column *)
Join[array, List /@ column, 2]

For other methods see the following MMa.SE thread and the threads referenced in it:

http://mathematica.stackexchange.com/q/44459/280

POSTED BY: Alexey Popkov
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