Silverfrost Forums

Welcome to our forums

Use of SUM intrinsic array operator

18 Jun 2008 10:38 #3373

Hello,

I want to sum the columns of a 20 x 20 array. So far I have used:

SUM (myarray,DIM=1)

which gives back an 20 element array with the sum of each row. I want to select the rows individually.

Is there a way of doing this using the intrinsic SUM command?

I thought of storing it in a string then reading the string into an array which could then be accessed an element at a time. Looking for a more concise way of doing it.

Thanks

David McMillan

18 Jun 2008 11:16 #3374

You can do things like:

rsum = sum(myarray(irow,:))

for a given irow.

18 Jun 2008 11:21 #3377

Perfect - thanks for that.

DM

Please login to reply.