Skip to main content
1-Visitor
February 22, 2012
Solved

ERROR ARRAY INDEX IS INVALID FOR THIS ARRAY

  • February 22, 2012
  • 3 replies
  • 18362 views

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

Do you can to help me.

Thank you

Best answer by RichardJ

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

3 replies

24-Ruby IV
February 22, 2012

See please red operators in attach

1-Visitor
February 22, 2012

HEllo,

You say :

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

What should I do to plot my chart?

1-Visitor
February 22, 2012

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

19-Tanzanite
February 22, 2012

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?

1-Visitor
February 22, 2012

How ignore the last one ? Please

last(duree -1) ?

RichardJ19-TanzaniteAnswer
19-Tanzanite
February 22, 2012

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