I am trying to get the average of every 10 points in my table...

I have a table of data and would like to get an output of the average every 10 points. For example, the average of points 1-10, then the average of points 11-20, then 21-30, etc.
The challenge is that I do not know ahead of time how many points the sensor will collect each run because it depends on some external factor. I have attached a picture with some made-up data to illustrate what my table looks like. In the example I attached, the averages would be (11+34+125+77+44+232+25+213+22+89)/10 and (90+45+77+26+1+22+57+67+360+33)/10.
My initial attempt used a case structure which found a running average and then reset whenever a multiple of 10 was reached. However, this method does not seem very efficient. Does anyone have any better ideas?
Solved!
Go to Solution.
Attachments:
sample data.JPG ‏43 KB

JarleEkanger wrote:
How about this? Use Delete array subset to extract chunks for averaging, and a shift register to retain the remaining array.
It is typically not advisable to use "delete from array" in a tight loop. The constant memory reallocations due to array resizing are probably inefficient.
Here's one simple way to do it..
(If the number of points is not divisible by 10, the excess tail is discarded. You can easily modify that behavior if desired.)
LabVIEW Champion . Do more with less code and in less time .
Attachments:
averages of 10.png ‏5 KB
averages of 10.vi ‏9 KB

Similar Messages

  • Getting the length between two points

    Hi All,
    I am trying to get the distance between two points and came across the SDO_LENGTH function in the manual - however there is no example on how to use it.
    I was expecting the following statement to return me the value 9 but instead I am getting errors along the lines of SDO_GEOM.SDO_LENGTH must be declared etc.
    =============================================
    SDO_GEOM.SD0_LENGTH(
    MDSYS.SDO_GEOMETRY(2
    ,NULL
    ,NULL
    ,MDSYS.SDO_ELEM_INFO_ARRAY(1,2,1)
    ,MDSYS.SDO_ORDINATE_ARRAY(1,1,10,10))
    ,MDSYS.SDO_DIM_ARRAY(MDSYS.SDO_DIM_ELEMENT('X',-180,180,0.0001)
    ,MDSYS.SDO_DIM_ELEMENT('Y',-90,90,0.0001))
    ============================================
    what am I missing
    any help appreciated
    Brent Glover

    I think I have found my answer
    ============================================
    DECLARE
    v_length NUMBER;
    BEGIN
    v_length := SDO_GEOM.SDO_LENGTH(
    MDSYS.SDO_GEOMETRY(2
    ,NULL
    ,NULL
    ,MDSYS.SDO_ELEM_INFO_ARRAY(1,2,1)
    ,MDSYS.SDO_ORDINATE_ARRAY(1,1,10,10))
    ,MDSYS.SDO_DIM_ARRAY(MDSYS.SDO_DIM_ELEMENT('X',-180,180,0.0001)
    ,MDSYS.SDO_DIM_ELEMENT('Y',-90,90,0.0001))
    DBMS_OUTPUT.put_line(v_length);
    END;
    =============================================

  • I'm new to Mac and the program/all called Numbers. I'm trying to use both Average and small in the same formula. What's I'm trying to do is take 20 cells, find the 10 lowest numbers, then get the average and after that multiply it by .96

    I'm new to Mac and the program/all called Numbers. I'm trying to use both Average and small in the same formula. What's I'm trying to do is take 20 cells in a column,  find the 10 lowest numbers, then get the average and after that multiply it by .96  I used to use Excel and the formula worked fine in that. Here is my Formula
    =(average(small(H201:H220,{1,2,3,4,5,6,7,8,9,10})))*.96
    This formula worked in Excel and when I converted my spreadsheet over to Numbers, this formula no longer works.
    The best that I have been able to do so far is use small in 10 different cells, then get the average of the 10 cells and finally multiply that average by .96  So instead of using 1 cell, I'm using 12 cells to get my answer.
    This is a formula that I will be using all the time. The next cell would be =(average(small(H202:H221,{1,2,3,4,5,6,7,8,9,10})))*.96
    Hoping I explain myself well enough and that someone can help me.
    Thanks

    You can still do it in one cell but it will be more unruly than the Excel array formula.
    =average(small(H201:H220,1),small(H201:H220,2),small(H201:H220,3),...,small(H201:H220,10))*0.96
    where you would, of course, replace the "..." with the remaining six SMALL functions.

  • Why can't I get the average function work with empty cells?

    Why can't I get the average function work with empty cells?

    The thing that I am having a problem with is that I made a different form that calculates the average no matter how may of the cells have numbers or not and I didn't use an if function.  I have tried with this other form and and it calulates as if all the cells where being used.  I am using the [*] in both instances but it only works in the one I did earlier.

  • Getting the average of a set of numbers, confused by file IO, please help!

    What i need to do is get the average of a set of numbers, the problem is that i am reading these numbers in from files in different directories where each file returns a number, and the average for the directory is the numbers for each file in that directory added together and divided by the number of files in that directory.
    public static HashMap readDir(File path, HashMap map) throws IOException{
            File files[] = path.listFiles();
            float totalForDirectory = 0;
             int common = 0;
             int count = 0;
                    if(files != null && files.length > 0) {
                              for(int i=0; i<files.length; i++) {
                                    if(files.isDirectory()) {
    readDir(files[i], map);
    } else {
    //trying to count the number of files in the directory
    count++;
    totalForDirectory =(total(common, totalF1(), totalF2(files[i])));
    readFile(files[i]);
    //will contain pathname, and the average
    map.put(path.getCanonicalPath(), totalForDirectory);
    return map;
    In the above code, totalForDirectory contains the number for each file, i want to add together the result of this variable for each file, "file[i]" in the directory, and divide that by the number of files in that directory.
    Id appreciate any help
    Thanks

    What you want, It seems to me, is a recursive routine (for directories) which returns both a total and a filecount. Then these can be totalled at each level (togther with the count for each file).
    Probably the best approach is to pass a small object in which the totals are accumulated.
    Define a class something like:
    public class Accumulator {
       int count;
       int total;
       public double mean() {
          return total / count;
      public void add(Accumulator add) {
         count += add.count;
         total += add.total;
       public void add(int numberFromFile) {
          count++;
         total += numberFromFile();
      }Create an instance of this at the start of your scan directory method, and pass it when you call make the recursion. At the end of the scan the method would use the first add method to add it's local totals to the hight level total.
    Obviously you create an Accumulator for the first scan directory call which becomes the grand total.

  • I'm trying to get the ios 4.2.1 on my second generation iPod . Is there a way to install it directly on my iPod touch because my iTunes on my computer is not working. Please help Apple! I need the update. Just give me a link.

    Im trying to get the ios 4.1.2 on my iPod touch 2nd generation. Can I install it directly on my iPod . My iTunes on my computer isn't working!

    you have to have itunes installed but check out http://support.apple.com/kb/ht4623.

  • Trying to get the Opening and Closing Balance, 0TOTALSTCK and 0VALSTCKVAL

    Hi Experts, Good Day.
    I am developing a query for Stock Balances, Using Custom cube created with copy from 0ic_c03.
    I am trying to get the Opening and Closing Balance, based on Non-Cumulative KF - 0TOTALSTCK and 0VALSTCKVAL.
    Both The KF's Behaviour for Exception Aggregat. = Last Value
    I am using VARIABLE OFFSET as -1 to get Opening Balance, and just restriction for Closing Balance based on 0CALMONTH
    Unfortunately i am getting data for the periods which does not have data in my Cube. It is taking the total value as closing balance for the periods which we don't have transaction in the cube.
    For Ex. I have data for 09.2010 & 10.2010 a particular material, when i enter 08.2010 as input i am getting the total value of the material.
    I hope you understand the problem and solution soon.
    I will give you more explanation if needed.
    Thanks in Advance....
    Have a great Day Ahead.....
    GopalN

    Hi GopaIN,
    can you explain us process you have done about initialization of data (2LIS_03_BX, cube compression)? it seams like there was data before 09.2010 and you load it with 2LIS_03_BX data source. That data is not in cube, but just used for update markers.
    Edited by: Sasa Todorovic on Mar 25, 2011 9:48 AM

  • I am trying to get the CLIPPINGS add on for firefox. but it says it is not compatible with FirFox 8.0 whaat can I do.

    I am trying to get the CLIPPINGS add on for firefox. but when I try and download it, it says it is not compatible with FirFox 8.0. also the latest version of firfox is 3.1 but my version is 8.0 Is that right?

    There were some issues with the addons site and checking for (compatibility) updates.<br />
    It seems to be working now, so you can try again to install the extension.

  • I was trying to get the iOS 8.2 on my iPhone 5 but then it stopped and my phone is now on recovery mode I have pictures I need and they did not all fit on iCloud  how can I use the phone again with ALL my pictures and videos without restoring it?

    I was trying to get the iOS 8.2 on my iPhone 5 but then it stopped and my phone is now on recovery mode I have pictures I need and they did not all fit on iCloud  how can I use the phone again with ALL my pictures and videos without restoring it?

    Contacts are designed to be synced to a supported application on the computer or a cloud service.
    Pictures taken with the device are designed to regularly be copied off the device to a computer as would be done with any digital camera.
    If you have failed to use the device as designed it may be too late to recovery anything.
    Is the device regularly backed up to a computer via iTunes?  If so, the most recent backup (when restored to a replacement iOS device) should contain all contacts and pictures as of when the backup was created.

  • Heey i bought an iphone 3gs about 2-3 months ago (used) today i blanked off the phone itself and then tried to get the newest update cuz i wasnt able to before so i did and now im locked out and it says sim failure invalid sim i can even get into it :(

    heey i bought an iphone 3gs about 2-3 months ago (used) was in mint condition well taken care of not even a scratch as soon as i got home i tried syncing it to my computer but didnt work it didnt even sync or notice my iphone software .. so i went to my friends and synced it there it has been working for music but videos wont work? but i didnt care  and then the pop up that says update so we would click it wait and it wouldnt work ever since ive had it so i left it like that so i went to my friend today i blanked it off the phone itself and then tried to get the newest update cuz i wasnt able to before so i did and now im locked out and it says sim failure invalid sim i can even get into it PLEASE HELP and cant get a new sim at the moment or take it into the apple store because i live about an hour and a half away from the city and rarley go to it please help me !!!!!!!!!!!!!!

    When I use find file http://www.macupdate.com/app/mac/30073/find-file (which does tend to find files that "Finder" can't), it's not coming up with any other itunes library files that have been modified in the past week, which I know it would have been - unfortunately, I don't have a very recent backup of the hard drive.  It would be a few months old so it wouldn't have the complete library on it....any ideas?  I'm wondering if restarting the computer might help but have been afraid to do so in case it would make it harder to recover anything...I was looking at this thread https://discussions.apple.com/thread/4211589?start=0&tstart=0 in the hopes that it might have a helpful suggestion but it's definitely a different scenario.

  • Ive just got a new iPhone4 and I am trying to get the App's ie games from my iPhone3 onto the 4 and retain the same levels that I have reached on the 3, The Apps have gone onto the 4 but its making me re-start everything from level 1?

    Ive just got a new iPhone4 and I am trying to get the App's ie games from my iPhone3 onto the 4 and retain the same levels that I have reached on the 3,
    The Apps have gone onto the 4 but its making me re-start everything from level 1?
    Ive paid $$ for the games and then more $$ within the games via iTunes for in game purchases and desperatly want the games on the 4 with the levels that I have reached on the 3!
    Can anyone help!! Please!!!! My Smurfs and Animals are starving Hahahaha

    Mate, it's good to hear that you have gotten the iPhone 4 but sorry to burst your bubbles. Not all games can have the "saved" data ported over.
    Normally when you save a game in iPhone, the memory used is in the flash memory of the device. Those that can be ported over, reason is due to the data being saved over the air and when you logged in on a new device, it recognises you via the userID.
    Maybe you can try to backup your iPhone 3, and restore the file onto your iPhone 4. Not too sure if that would brick your phone though.

  • HT1373 i have a broken desktop which had my itunes account on it. I am trying to get the information onto a new laptop and itunes programme but cannot. I also cannot get my iphone 5 to be recognized on the new itunes. HELP

    i have a broken desktop which had my itunes account on it.
    I am trying to get the information onto a new laptop and itunes programme but cannot. I have only managed to copy over some of my music as i had it on an external drive.
    I also cannot get my iphone 5 to be recognized on the new itunes.
    HELP

    iTunes as you see it in the application window uses a series of files and folders contained in the iTunes folder.  Some people make the mistake of only backing up their media in which case all you have is a bunch of media files without the iTunes structure.  In that case you have to build a new library yourself.
    What exactly do you mean "not recognized"?  The phone does not show up on the computer at all, or it does but it says it will wipe the phone?  The wipe the phone stuff is again because it cannot find the original library to which it was synced.  You need to transfer the entire iTunes folder from the old computer or the backup you made of it.
    What are the iTunes library files? - http://support.apple.com/kb/HT1660
    More on iTunes library files and what they do - http://en.wikipedia.org/wiki/ITunes#Media_management
    What are all those iTunes files? - http://www.macworld.com/article/139974/2009/04/itunes_files.html
    Where are my iTunes files located? - http://support.apple.com/kb/ht1391

  • Help Please! I am trying to get the 7232 DVR

    I have been trying to get the 7232 DVR since installation.
    My Triple Play was installed on 12/23/2011 and I was given NO DVR.
    I was told I needed to go to the neaest store to get my DVR. At the store they told me they did not have the 7232 but gave me an older DVR, the only one they had in stock but I should call customer service to get the 7232 DVR.
    I called customer service and they said I could only order the 7232 online. I ordered it online around 1/1/2012. Ticket NJDQ026S1V
    I called customer service today and they have no idea where I am in the waiting list and how long it will take.
    I don't think it si fair that since the installer made a mistake that I get stuck with an old DVR.
    Please tell me what I can do
    Thank you for your help 

    The installer did not make a mistake. Installs are done with available equipment. The installation tech likely did not have that box. That ticket you referenced did not show ordering a box. The 7232 can not be ordered on the phone. It must be ordered online. Please follow these steps...
    Go to www.verizon.com/fiostvcentral 
    Sign In
    Select the “FiOS TV” Tab
    Select “Settings”  sub-listing
    Select “Set Top Boxes” from the drop down list
    Select the “Go” button under “Want more from your FiOS DVR.”
    Anthony_VZ
    **If someones post has helped you, please acknowledge their assistance by clicking the red thumbs up button to give them Kudos. If you are the original poster and any response gave you your answer, please mark the post that had the answer as the solution**
    Notice: Content posted by Verizon employees is meant to be informational and does not supersede or change the Verizon Forums User Guidelines or Terms or Service, or your Customer Agreement Terms and Conditions or plan

  • I am trying to get the music content on my Mac onto my iPhone. When I connect the devices, the computer does not seem to recognize the iPhone, i.e., on the open itunes window, the iPhone is not seen as a connected "device".

    I am trying to get the music content in iTunes on my Mac onto my iPhone. When I connect the devices, the computer does not seen to recognize the iPhone. i.e., on the open iTunes window, the iPhone is not seen as a connected "device".

    Hi,
    See Here
    iPhone, iPad, or iPod touch not appearing in iTunes
    From Here
    http://www.apple.com/support/itunes/devices/
    Also...
    Device Not Recognised
    For PC
    http://support.apple.com/kb/TS1538

  • How do you get the average of an array bigdecimels

    how do you get the average of an array bigdecimels... I am looping through the array in a for loop
    for (int i = 0; i < prItems.length; i++) {                                                                                                                                                                                                                                                                                                                  

    int sum = 0;
    for (int i = 0; i < prItems.length; i++) {
    sum = sum + prItems;
    int avg = sum/prItems.length;

Maybe you are looking for

  • Difference in FD10n and FBL5n balance

    Hi, I have problem with those two reports, they show different balance. I think it is because balance from the 2007 havenu2019t been u201Ccarried-forwardu201D to 2008. How can I do that for the Customeru2019s account ? I am looking for a similar tran

  • Smart Guides in Indesign aren't working suddenly

    I am working on a 100 page catalog.  I am on page 70 and suddenly my smart guides will not work for all of the next pages after page 70.  If I go back to any of the previous pages the smart guides work without a problem.  Any thoughts or ideas as to

  • Error executing Maven

    I have installed the Axis2 and tried to run the application using "maven-package". I am getting this error. How to create this settings.xml file [ERROR] Error executing Maven. [ERROR] The specified user settings file does not exist: C:\Documents and

  • ICloud will immediately delete the emails once a sync has occurred

    As the tiltle shows, since yesterday, all emails goes to iCloud will immediately delete the emails once a sync has occurred. Sent emails will be kept into place, but I keep losing incoming Emails. Please help. Regards, Anning

  • I keep losing my new bookmarks after I Sign off Safari and Sign in again

    I transfered my bookmarks over from my other computer and I am trying to add more bookmark folders, after I am done and quit Safari,  later go  back to Safari and everything I have added is gone, Back to where I was before. Why is this happening and