forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Use of SUM intrinsic array operator

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General
View previous topic :: View next topic  
Author Message
dmcmillan



Joined: 04 Jul 2006
Posts: 22

PostPosted: Wed Jun 18, 2008 11:38 am    Post subject: Use of SUM intrinsic array operator Reply with quote

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
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7925
Location: Salford, UK

PostPosted: Wed Jun 18, 2008 12:16 pm    Post subject: Reply with quote

You can do things like:

rsum = sum(myarray(irow,:))

for a given irow.
Back to top
View user's profile Send private message AIM Address
dmcmillan



Joined: 04 Jul 2006
Posts: 22

PostPosted: Wed Jun 18, 2008 12:21 pm    Post subject: Reply with quote

Perfect - thanks for that.

DM
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group