SHAZAM Community
Ask Your Question
0

MATRIX ALGEBRA

asked 2017-02-02 13:26:06 +0000

TL gravatar image

updated 2017-02-04 16:57:28 +0000

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 flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2017-02-04 17:58:09 +0000

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.

edit flag offensive delete link more

Comments

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.

TL gravatar imageTL ( 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
TL gravatar imageTL ( 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
SHAZAMHelp gravatar imageSHAZAMHelp ( 2017-02-10 09:06:16 +0000 )edit

Thanks!

TL gravatar imageTL ( 2017-02-15 20:45:26 +0000 )edit
Login/Signup to Answer

Question Tools

Stats

Asked: 2017-02-02 13:26:06 +0000

Seen: 980 times

Last updated: Feb 04