Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X
Hello,
In the attached Mathcad sheet, when you scroll about one third down , under section 5.1, i get the error"This array index is invalid for this array". i am not sure what the error is and how to fix it. it happens in all the areas under section (5.1).Any assitance will be appreciated. Thanks!
Use "Trace error" to let you show the position of the error. Its in the sum above.
You are summing from 0 to n.P+1. n.P=20, so the max index is 21.
The sum uses vector P which has 22 elements and vector NC_a which has only 21 elements. So index 21 is invalid for vector NC_a.
Can't tell how to fix as I cannot be bothered wading through THAT file 😉
you stated that vector P has 22 elements. how did you determine that?Thanks!
There are two useful commands:
rows(P) tells how many rows there are in a matrix or vector
cols(P) tells how many columns
rows(P) tells how many rows there are in a matrix or vector
cols(P) tells how many columns
Yes, useful, indeed. And for vectors we additionally have lenght(P) and last(P).
I used the latter - it returns the last valid index of a vector and in case of your P this is 21.
But of course rows(P) would have done the job as well.
There issomething i dont understand., in your answer, you stated vector P has 22 elements, but when i count the elements there are 21.in your last answer, the index for P is 21. when i typed rows(P) i get 21.
No, I got 22 rows, indexed from 0 to 21 for P. This wasn't the problem. The problem was NC_a which had one element less.
Sorry, I have problems inserting pics when I edit a post the second time.
So lets try it again: