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

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

ERROR ARRAY INDEX IS INVALID FOR THIS ARRAY

ptc-4346041
1-Newbie

ERROR ARRAY INDEX IS INVALID FOR THIS ARRAY

i DON'T UNDERSTAND this error : ERROR ARRAY INDEX IS INVALID FOR THIS ARRAY

Do you can to help me.

Thank you

1 ACCEPTED SOLUTION

Accepted Solutions
RichardJ
19-Tanzanite
(To:ptc-4346041)

A slight modification makes it work in either case. With an odd number of elements the last element is ignored.

View solution in original post

7 REPLIES 7

See please red operators in attach

HEllo,

You say :

So, i should have last(Phase°)>last(tpas) ? Is that ?

What should I do to plot my chart?

mcad1.png

Error simply means that you are trying to use an index for a vector that exceeds the maximum index you have defined. You have defined duree to run from 0 to 50.

But in the box that is generating the error your index 2*s+1 can go up to 51 if s=25.

The problem is that in the way you currently define it x can only really run from zero to 24 or you can modify it to run from 1 to 25. You would have to change your definition if you want to run it from zero to 25.

Another possibility of course is that could define a value duree(51) and that would solve the problem. However, that may not be a meaningful solution in your problem.

I could not see any other problems in the program other than a couple of charts not plotting, but that was only because you defined the variables below the chart. You obviously have to define them before you plot them.

Other than that check that you have set ORIGIN:=0 in you worksheet preferences.

Best of luck

dave

RichardJ
19-Tanzanite
(To:ptc-4346041)

When I replied to your earlier post (http://communities.ptc.com/message/176748#176748) I assumed the input vector would always have an even number of elements. If it has an odd number of elements the expression for the upper limit of the loop returns an out of range index. But, based on your question, an odd number of elements does not make much sense. What do you want it to do if it has an odd number of elements? Just ignore the last one?

How ignore the last one ? Please

last(duree -1) ?

RichardJ
19-Tanzanite
(To:ptc-4346041)

A slight modification makes it work in either case. With an odd number of elements the last element is ignored.

Thank you very much, all everyone

Top Tags