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

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

Summing large tables

ptc-5130546
1-Visitor

Summing large tables

I'm trying to process a set of data that I have for limits generation. I am using MathCad to validate some limit generation algorithms that we will be using in a software tool that we are developing (no relation to Mathcad).

So, I have a problem:

The summation function only seems to work on matrixes and tables of less than a certain size:

3.png

If I define y_n to be a subset of the tables that I have, I get a summation. But if I try to sum an entire column, I get the error you see.

I have tried using a for loop to manually sum the elements of the table, but I get the same result as above. I will also get an error if I set the range variable n (in the screenshot above) to be 0...20 (or greater).

What am I doing wrong?

ACCEPTED SOLUTION

Accepted Solutions

Valery, the problem is not the way how to sum up. It works the way Jeff had done, too.

It looks like one of the elements in Jeff's matrix is a string or a matrix instead of a scalar and that throws the error.

View solution in original post

8 REPLIES 8

May be so (ORIGIN=0):

sum.png

I'm not trying to sum all elements of the matrix. I am trying to sum any given column of the matrix (which is very large). It appears that when the matrix is larger than a given size that the summation will not work. You should see this if you made your matrix more than 19 elements in either dimension.

Jeff Lambert wrote:

I am trying to sum any given column of the matrix (which is very large).

I am trying to sum elements (?) any given column of the matrix (which is very large).

Sorry I do not see a problem. One more variant of solution.

sum1.png

Valery, the problem is not the way how to sum up. It works the way Jeff had done, too.

It looks like one of the elements in Jeff's matrix is a string or a matrix instead of a scalar and that throws the error.

Yeap, that was the problem. I didn't notice that when I exported the data from Excel into the text format that I used that some of the data had "m" in it to specifify milli-dB. Now it's fixed and the summation works as expected!

Werner_E
25-Diamond I
(To:ptc-5130546)

Its hard to impossible to debug a mere picture!

You should attach the worksheet or, if thats not possible as of sensible content, you should create and attach a dummy worksheet, showing the same error.

You can attach sheets

There is no limit in respect to vector/matrix sum and it should work (and does for me) the way you had set it up. And a matrix of the dimensions you are dealing with wouldn't be called large.

Best guess is that in your first column in a row with an index greater than 19 there is an element which is not a scalar value, probably a textstring or a matrix (maybe just a 1x1 matrix). From the description of your problem you should have a look at the element GainResponse[20,0.

How are the values for you matrix are generated? Is there some kind of symbolic solve or find involved? This could find more than one solution for a specific combination of parameters and so the result would be a column or row vector and not a single scalar.

Or maybe the data is read from an external file and the element happened to be interpreted as text instead as scalar number.

Column_Sum.png

The problem is that I cannot just upload the worksheet because it references external files with confidential data (as Werner has suspected) that is being loaded with the file import function.

I will check this tomorrow as well as find another way to upload the worksheet if I cannot get this to work.

Thanks for the suggestions so far!

Have a look at the attached. I have used a couple of user defined functions and it works for over 20 elements.

Mike

Announcements

Top Tags