# MATRIX ALGEBRA

I have a matrix A. Let's say 10 columns and 50 rows. Problem: I want to delete rows 25 to 30, and use the remaining part of the matrix in the calculations. I checked the Shazam manual (pp. 406-407), but the example was not easy to understand. Any good ideas how to delelete rows (and columns)?

Regards, TL

edit retag close merge delete

Sort by ยป oldest newest most voted

You are on the right track using the COPY command. You just need to specify the starting and ending rows. Here is an example:

* Create random matrix
matrix A = uni(10,2)
print A

* Copy the last 5 rows of A into the 1st 5 rows of B
dim B 5 2
copy A B / frow=6;10 trow=1;5
print B


Hope this helps.

more

It helps, but not 100%. Question: Let's say you want to delete rows # 5, 6, and 7. Great if you can provide us with a solution.

TL.

( 2017-02-08 10:10:02 +0000 )edit

Solution: I think the following script will do:

sample 1 4 8 10
copy A:1 A:2 B

( 2017-02-08 11:08:01 +0000 )edit

Yes that is correct. Note that you don't need to specify the columns if taking the whole matrix so the

copy A:1 A:2 B


can just be

copy A B

( 2017-02-10 09:06:16 +0000 )edit

Thanks!

( 2017-02-15 20:45:26 +0000 )edit