Reporting the Average of a Looped Dimension

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Reporting the Average of a Looped Dimension

    I am a Level 1 programmer trying to do Level 3 programming. I am writing a program to prove the repeatability of the ROMER calibration bar. I have the Loop completed with the dimension for the long length and the short length and it seems to work fine. I am trying to report the average of all 30 dimensions using this programming that I wrote. I couldn't write all 30 in one line for one variable, so I did 10 dimensions for three different variables. My other question, is there a way to shorten this up to one variable.

    ASSIGN/V2=ARRAY(DIM1[1].MEAS, DIM1[2].MEAS, DIM1[3].MEAS,...............)
    ASSIGN/V3=ARRAY(DIM1[11].MEAS, DIM1[12].MEAS, DIM1[13].MEAS,.........)
    ASSIGN/V4=ARRAY(DIM1[21].MEAS, DIM1[22].MEAS, DIM1[23].MEAS,..........)
    ASSIGN/V5=(V2+V3+V4)/30


    I'm not sure how to get it to report, so I don't know if it is actually working correctly. I just need to prove the average of the 30 dimensions are within the spec.
    I Work In Quality not Quantity

  • #2
    I would try, inside the loop (if V1 is the loop variable !)
    ASSIGN/V2[V1]=DIM1.MEAS
    Then after the end of the loop
    ASSIGN/V3=SUM(V2)/30

    Comment


    • Grover
      Grover commented
      Editing a comment
      How do you get it to report the variable "V3"?

    • InspectorJester
      InspectorJester commented
      Editing a comment
      I'm guessing what this does is add up all of the data in the array and divide it by the number of elements in the array? (in this case 30)
      I like.

  • #3
    Insert a comment/report/ "Average dim is : "+V3
    or create a generic feature whose length is V3, and dimension it.

    Comment


    • #4
      Originally posted by JEFMAN View Post
      I would try, inside the loop (if V1 is the loop variable !)
      ASSIGN/V2[V1]=DIM1.MEAS
      Then after the end of the loop
      ASSIGN/V3=SUM(V2)/(LEN(V2)-1)
      May or may not need to subtract 1 from the LEN() could just be ASSIGN/V3=SUM(V2)/LEN(V2). That way you don't have to stick to 30 loops, it could be 1 to ∞.
      PcDmis 2015.1 SP10 CAD++
      Global 7-10-7 DC800S

      Comment

      Related Topics

      Collapse

      Working...
      X