cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

sum of array element

malsoufi
1-Visitor

sum of array element

I am trying to sum of array elements. can someone help me to do this.

the attached picture is extracted from vba.

vba_function.jpg

9 REPLIES 9
StuartBruff
23-Emerald III
(To:malsoufi)

Mounir AL SOUFI wrote:

I am trying to sum of array elements. can someone help me to do this.

the attached picture is extracted from vba.

vba_function.jpg

Do you mean something like this?

Stuart

Yes,but the problem that mathcad gove me error becuase it can't recognize matB when adding to mat c

StuartBruff
23-Emerald III
(To:malsoufi)

Mounir AL SOUFI wrote:

Yes,but the problem that mathcad gove me error becuase it can't recognize matB when adding to mat c

Did you run the attached worksheet?  I've just run it again for various values of matrix size and it seems to work on my M15.

I notice that in your original post, you give the variable names as MatA, MatB & MatC, whereas you mention matB & matC above - Mathcad variable names are case sensitive, so you need to ensure that all variables are spelled consistently.  You also need to have defined all of the variables before you can use them.

Stuart

I did more simple code on Mathcad.can you please check it?

StuartBruff
23-Emerald III
(To:malsoufi)

Mounir AL SOUFI wrote:

I did more simple code on Mathcad.can you please check it?

The code looks basically all right (apart from not returning the matrix SO), but you need to define the SO matrix before you can use it.

Stuart

Yes,but the problem that mathcad gove me error becuase it can't recognize matB when adding to mat c

I'm not sure how this code makes any sense.

But it works if all three matrices already exist.

CAN YOU PLEASE SEE THIS CODE?@

Werner_E
25-Diamond I
(To:malsoufi)

I guess you were already told what the problems with your sheet are:

1) You have not defined the Matrix PO. You use elements of that matrix in your sums, so Mathcad has to know whoch values it should add.

What you are doing is like defining

L:=25

and then trying to calculate

PO := PO + L

Mathcad tries to evaluate the right hand side and does not know the value of PO. So it has to throw an error.

2) Your routine does not return the Matrix PO as a result. So kl would just be the result of the last addition.

R

Announcements

Top Tags