# Summing specific columns in a 2D wave Hi,

I have a 2D wave with 23 rows and 19 columns: datawave (23,19)

Now, I want to create a new 2D wave newdatawave(23,11) which will have the first 10 columns from datawave as is. For the 11th column, I want the horizontal sum of 11-19 columns from datawave.

I am trying MatrixOp to accomplish this via a 1-2 liner code but couldn't get the right syntax.

Kindly help on how to accomplish this task.

This is how I would do it:

Make/O/N=(23,19) aa=gnoise(1)
// duplicate first 10 cols of aa into new wave called bb
Duplicate/O/RMD=[][0,9] aa, bb
// sum along the rows using matrix op
Matrixop/O cc = sumrows(bb)
// now stick them together to give dd with dimensions 23,11
Concatenate/O/NP=1 {bb,cc}, dd

You can save one line using:

`MatrixOP/O bb = catcols(bb, sumrows(bb))`

EDIT:

ok, turns out you could even do a one-liner (although I wouldn't recommend that):

`MatrixOP/O bb = catcols(redimension(aa, 23, 10), sumrows(redimension(aa, 23, 10)))`

Still, MatrixOP is awesome!