How to resize a matrix?

How to resize a matrix? - Messages

#1 Posted: 11/24/2010 1:11:37 PM
Konrad

Konrad

1 likes in 24 posts.

Group: User

Hi All,
I have a big matrix defined, many rows and columns laboriously entered. Now I need this matrix to have one more column or row in the definition. Can I do it? If not, can I copy and paste the contents of the old matrix to a new bigger one? Manual rewriting kind of scares me...
Konrad
PS I know there is augment(), but I need to do it in the definition.
#2 Posted: 11/24/2010 1:21:07 PM
Konrad

Konrad

1 likes in 24 posts.

Group: User

OK, I found some way: I have my old matrix, say 50x50. I define an additional vector, 1x50, augment(old,additional) and display the result which is a matrix 51x50, select all values and ctrl+C. Now I define a new, empty matrix 51x50, select all empty fields and ctrl+V. Delete the old one and there it is! Adding a row takes transposing, doesn't hurt anyway.
Any smarter ideas?
#3 Posted: 11/24/2010 3:06:19 PM
Radovan Omorjan

Radovan Omorjan

325 likes in 2052 posts.

Group: Moderator

Hello Konrad,

Me again

If you have large matrices of data, I would advice you to use importData() function. You can input your data matrix in different software (even in a text editor) and export it as a text file with rows and columns of data. Then you can use importData() and import it into a matrix (I think that exportData() function is not implemented yet in SMath). Your entered data will remain preserved this way while you are manipulating with matrices in SMath. Displaying large matrices in SMath is not advisable because they will cover lot of page area and it is hard to work this way. You can display part of it with submatrix() function.
Combining matrices, vectors can be aranged with augment() - matrices with the same number of rows and combined horizontaly, or stack() - matrices with the same number of columns and combined verticaly.

I hope this is maybe a partial answer to your question.

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#4 Posted: 11/25/2010 6:03:54 AM
Konrad

Konrad

1 likes in 24 posts.

Group: User

Hi Radovan,
Stack! Of course, I missed it. You're helpful, as always. Thanks.
ImportData() seems useful, but so far they're not really large. As long as it fits on the page with a small font, I prefer to work without any external data source (less software validation & verification). I miss Mathcad's "reference", but I can live without it.
Konrad
#5 Posted: 11/25/2010 6:28:45 AM
Radovan Omorjan

Radovan Omorjan

325 likes in 2052 posts.

Group: Moderator

You are welcome

Btw, if you like to extract single rows or columns - just do not miss row() and col() functions.

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
  • New Posts New Posts
  • No New Posts No New Posts