Reputation: 11741
I've a DenseMatrix
1 2 3 0 0 0 0 0 0
0 0 0 11 22 33 0 0 0
0 0 0 0 0 0 111 222 333
I want to remove the first row and then a last row with all 0
s
0 0 0 11 22 33 0 0 0
0 0 0 0 0 0 111 222 333
0 0 0 0 0 0 0 0 0
How do I achieve this in Breeze ?
Upvotes: 1
Views: 947
Reputation: 21690
First, gather the rows you still want:
val subset = matrix(::, 2 to 3)
then add the zeroes:
val newMatrix = DenseMatrix.horzcat(subset, DenseMatrix.zeros[Double](1,9))
I might have mixed up rows and columns in the last line.
Upvotes: 3