Re: how to 'edit' MatrixForm output to create a new matrix?
- To: mathgroup at smc.vnet.net
- Subject: [mg45256] Re: how to 'edit' MatrixForm output to create a new matrix?
- From: Bill Rowe <readnewsciv at earthlink.net>
- Date: Wed, 24 Dec 2003 04:35:56 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
On 12/23/03 at 5:13 AM, nma124 at hotmail.com (steve_H) wrote:
> For an example, say I create a 2x3 matrix:
> m= { {1, 2, 3}, {4, 5, 6} } // MatrixForm
> Now I want to make it say a 3x3 matrix, so I copy the output
> from the above command (by selecting it with the mouse and then
> copy and paste to a new cell)
> Now I need to edit the matrix to say add another row or another
> column. But can not figure how to do it.
There are a variety of ways to add a row or column. For example, adding a row can be done with
Join[m,{{7, 8, 9}}] or
Flatten[{m, {{7, 8, 9}}, 1]
adding a column can be done with
MapThread[Flatten@{#1,#2}&,{m, {7, 8}}] or
Transpose@Join[Transpose@m,{{7, 8}}]
or you could use the routines AppendRow and AppendColumn in the package LinearAlgebra`MatrixManipulation`
And I am sure there are other ways.
--
To reply via email subtract one hundred and four