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

      • MihaelR
        Multiple variables
        MihaelR
        Hi, I have 34 variables and each one of them represents a z-value. These variables I use in a loop, and every run the loop uses one variable, however,...
        03-15-2017, 02:19 PM
      • Chuck
        Circle Averages
        Chuck
        I'm trying to get the average diameter of some circles and report them. So far I have done this:

        ASSIGN/V1= CIR1.+CIR2.+CIR3./3
        ...
        12-14-2006, 04:24 PM
      • hemirunner
        Ideas Please: Automate Average Polar Radius
        hemirunner
        I need to take the PR of a bunch of hits and average it out to use in a generic feature for reporting. I wrote it out the long way but I'd like anybody's...
        10-23-2013, 12:23 PM
      • inspector212
        Variable Array
        inspector212
        How do I shorten up this array? I don't want to type in all of the locations. I searched and didn't find anything.

        Code:
        ASSIGN/V1[1] = MAX(ARRAY(LOC50.T.MEAS,LOC51.T.MEAS,LOC52.T.MEAS,LOC53.T.MEAS,LOC54.T.MEAS,LOC55.T.MEAS,LOC56.T.MEAS,LOC57.T.MEAS,LOC58.T.MEAS,LOC59.T.MEAS))
        ...
        08-07-2008, 03:25 PM
      • bquality
        Need help!
        bquality
        I need to create a plane using the highest points out of 4 groups of points, but I also need to know which one point out of the group is the highest point...
        06-10-2009, 05:02 PM
      Working...
      X