Clear array and take average of values in array continuously

I have a continuous signal that I am acquiring with hardware (sampling at 1000Hz).  I want to be able to insert the data into a 1D array for 5 seconds, and then take the average of these 5000 samples.  So basically, every 5 seconds I need to take the average of a 1D array and create a new array for the next 5000 samples.

There is no reason to accumulate the data into an array if all you need is the average.
Simply add the values into a shift register. Every 5000 points devide the sum by 5000, output the average, and zero the shift register for the next series of data..
LabVIEW Champion . Do more with less code and in less time .

Similar Messages

  • Take out multiple values from a db and handle them in an applet.

    I have a db with tables. I want to take out several values from them and make them visible in a JFrame (or applet).
    I dont know how to do. I have an app that connects to the db and selects the values and puts the Strings in a Vector. But now then?
    I have looked at examples that retrieve Strings but not vectors, isn't that possible?

    Hi,
    On initialization of your frame you can loop over your vector and display them.
    Now the problem is in what type of component do you want to put your data.
    I can give you an example.
    What you can do is create a String which will contain all the data from
    your vector and set that string to the component.
    Example:
    Vector data;
    String result;
    for(int i=0; i < data.size(); i++) {
    result += (String)data.elementAt(i) + "\n";
    Now you need to put the string into a component which is easy done.
    Let take a textarea component.
    JTextArea txaTest = new JTextArea();
    txtTest.setText(result);
    Now all the data will be shown in the textarea component on your frame.

  • GR/IR clearing when there is difference in value and quantity is matching

    Dear friends,
    I'm having a problem to clear the GR / IR account where there is a value difference in dr and cr line items. when ther is foreign currency postings some of the dr or cr line items are having value difference in decimals. I checked the tolerance limits also still those entries are pending for clearing in f.13. This is GR/IR clearing account so I cannot do manual clearing. This has to be done through automatic clearing. Please reply in detail. Thanks in advance for going through my query and for giving your value time.

    Hi
    debit GR/IR 10000.99
    credit GR/IR 10000
    Credit P/L .99(as per the setting it will hit the account.
    Please guide me how to credit the .99 and where the settings and what settings has to be done.
    GR/IR is an auto clearing. So how can I post that difference which you suggested.
    regards
    satya
    Edited by: SATYA on Aug 24, 2009 8:38 AM

  • How to take a field value in an array?

    how to take a field value in an array? its urgent........

    yaa... i know,  but actually we need to  multiply that number with some digit.
    take it this is way, if  i push it into another array, we have an array of digits but what i need is a all digit to be together to be multiplied to a number
    for example -
    if i push the numbers into new array say arr[];
    so i will have something like this. arr[1,2,3,4,5,6.......]  
    but i need  the new varaible should have value as 12345........   all concatenated.
    if i perform operation on array each digit will be multiplied individually.
    hope u got what m trying to sayy....
    Thanks for the prompt response..........

  • LOVE Firefox! I have just launched a website. One designer told me it takes 7-10 days for any changes to appear. Why? I have cleared caches and cookies etc. I need to be more responsive than 7-1o days. I need changes to appear within 24hrs.

    LOVE Firefox! I have just launched a website: www.animalhealingandhumans.com. My web designer told me it takes 7-10 days for any changes to appear. Why? I have cleared caches and cookies etc. I need to be more responsive than 7-1o days. I need changes to appear within 24hrs. How can I achieve a much better response time to good feedback?

    Hello binbingogoABC,
    Shopping on BestBuy.com should be easy and fun and not fraught with the kind of trouble that you describe. I regret very much that this has been your experience.
    Using the information you provided when you signed up for Best Buy Unboxed I was able to locate your cancelled orders. I have requested more information from my back-office partners. As soon as I have additional details about your situation, I will reply again to this message. In the interim, I'm sorry that I must impose upon your patience.
    I'm very grateful that you wrote to us with your concerns.
    Sincerely,

  • Updating a row is not reflected after committing and it takes the old value

    Sir,
    I have been stuck at this problem for quite some time. So, I have a updatable table with editall property but i am controlling each column's read only property based on the value of the checkbox present in that table.So, if the user clicks on the checkbox ,the entire row becomes editable. But when i am changing the value of the row and pressing the commit button , it does not take the new value but the postback happens with the old value only. If i just drag the table as editall table and edit something , the commit button does reflect the change.
    How to solve this. Please help

    Frank,
    The reason i am not using the ClicktoEdit feature is because my aim is that the user clicks on multiple checkbox and then press the update button ,then all the checked rows becomes editable and the user can update them. But unfortunately, this feature is also not working .I am going step by step. So, i have checkboxes which the user can click to update them but it is not committing the change. Could u please help me or suggest some other way round. If u want any other information , please do ask.
    Thanks

  • Clear history hangs and takes quite a while to complete even when only one site is visited

    clear history hangs and takes quite a while to complete even when only one site is visited . While not a major problem it is annoying

    Hi Frank,
    Does this Release Management performance isssue occurred when you use it at first time? Do you have any setting on your TFS? Would you please tell us your TFS version? 
    If you have any repro steps, please share with us, thank you. 
    Best Regards,
    Dear Molly,
    Yes, this issue has occurred right from the beginning when we started using Release Management.
    Could you please clarify what you mean by "do you have any setting on your TFS"? As far as I know, our TFS installation is a straightforward and normal one.
    Our TFS version is TFS 2013.
    The steps to reproduce (in the simplest scenario) are as follows:
    Create a new project in Visual Studio 2013, containing one PowerShell script file. In the script file, perform a simple command such as "New-Item E:\Temp3 -itemtype directory -force".
    Perform a successful build of the project, making sure that the script file is copied to the drop folder.
    Create a vNext Component in the Release Management Client, that refers to the directory in the drop folder that contains the script file.
    Create a new vNext Release Template in the Release Management Client, containing one "Deploying using PS/DSC" action. In that action, set the PSScriptPath to the script file we created.
    Perform a new Release using the Release Template we just created. The Deploy action will take a long time, even though the script itself takes less than a second to run.
    Please let me know if you need any more information.

  • I cannot get the Quicktime plugin to update from v7.7.3 to the CURRENT 7.6.6 . My plugins view tells me I'm at risk and need to update but try as I might, it won't take. I consider myself and above average Mac User. Please advise. Thank you

    for some inexplicable reason, I cannot get the Quicktime plugin to update from v7.7.3 to the CURRENT 7.6.6 . My plugins view tells me I'm at risk and need to update but try as I might, through all the known update avenues, it won't take. I consider myself and above average Mac User. Please advise. Thank you

    Someone recently noted a problem staying logged on the Huffington Post since it became connected with AOL. The workaround for that is to change your connection setting here:
    orange Firefox button (or Tools menu) > Options > Advanced > Network
    Click the "Settings" button and choose either "No Proxy" or "Use System Settings" option, and OK the change.
    Not sure whether Washington Post could be affected by that same setting.
    In reviewing your extensions, I'm puzzled that you have both DoNotTrackMe and SavvyConnect. The first one seems to aggressively block certain communications with websites (potentially affecting functionality) while the second one seems to report on your browsing habits (they better pay well is all I can say). Have you tried disabling both of those to see whether that has any effect?
    orange Firefox button (or Tools menu) > Add-ons > Extensions category

  • Ok, im new to numbers but i cant work this one out. In column A is an average of hours worked. I have 4 columns. A and B have different values. Column C is an average of hours worked. When column C is less then 8 i need column D to equal column a

    Ok, im new to numbers but i cant work this one out. I have 4 columns. A and B have different values. Column C is an average of hours worked. When column C is less then 8 i need column D to equal column A. When column C is equal or greater then 8 i need column D to equal the sum of A and B.

    Hi Lucas,
    Try this:
    Formula in D2 (and Fill Down) =IF(C2<8, A2,A2+B2)
    The IF function follows the logic of if, then, else.
    IF(this is true, then do this, else do that)
    If it is raining, then stay at home, else hold a picnic .
    Regards,
    Ian.

  • How can I select an area of a picture (larger than one pixel) and find the average RGB values of all the pixels contained inside the area?

    I'm analysing the differences between several different images and I would like to select a large area of each (such as with lasso tool) and find the average RGB value of all of the pixels within the selection area made/

    With the selection you could do a copy paste and use the histogram of the new layer set the histogram source to selected layer.  The eye dropper sample size may also to get the average  of a square area around a point.

  • I often clear history and cache. With 4.0 it takes WAY too long. Why?

    I often clear history and cache. Before 4.0 it took a few seconds, but now it takes over a minute. Why?

    markymarkwahlberg wrote:
    Hi, I am loading music onto my z10 by just dragging dropping into the music folder on my sd card (about 4 gb music) and it is plugged into the usb, and I'm finding it is taking soo long (10 hours estimated already waited an hour) previously i loaded an even bigger file and it was long but never took this long (maybe took 2-3 hours previously). Just wondering why it takes soo long to write to an sd card as opposed to downloading from the internet or downloading over wifi or if there is something wrong with my setup (im running windows 7 with a decent laptop by 2 years ago standard), just hoping someone can comment on what they know or have experienced 
    Thanks Mark 
    i use a SD adapter in my laptop which works faster than using a cable to my Z
    A single large file when copying is faster than many smaller files on almost any SD card.
    I sometimes use wifi sharing and just let it do its thing while doing some thing else
    Click here to Backup the data on your BlackBerry Device! It's important, and FREE!
    Click "Accept as Solution" if your problem is solved. To give thanks, click thumbs up
    Click to search the Knowledge Base at BTSC and click to Read The Fabulous Manuals
    BESAdmin's, please make a signature with your BES environment info.
    SIM Free BlackBerry Unlocking FAQ
    Follow me on Twitter @knottyrope
    Want to thank me? Buy my KnottyRope App here
    BES 12 and BES 5.0.4 with Exchange 2010 and SQL 2012 Hyper V

  • Material Variant of a Config Material to take Charac. Values from Sales Ord

    Hello Guys,
    Is there any way to have a Material Variant for a Configurable Material to take the Characteristic values from a Sales Order instead of Material Master ?
    I understand by default Material Variant has fixed characteristic values and is taken from material master......
    however here is the situation am in.......
    I have a completely MTO scenario where we will making the product from scratch only after we know the characteristic values.......however our Costing Guys want to do standard cost estimate for the Configurable Material somehow......they were able to do Cost Rollup by making the Configurable Material itself as the Material variant of itself (assigning the same Configurable Material # in MRP3 view)............however this broke my design of taking characteristics from the Sales Order...because the Configurable Material is now behaving as Material Variant and taking the default characteristic values from the Material Master....
    Note: Our Costing guys donot want to cost settlement at Sales Order level.
    Regards,
    BRN.

    I had exactly the same problem. (configuration "blocked" in SO because the use of material variants for PC purposes...)
    SAP help says : To allow you to change the configuration of material variants in the sales order, the Configuration allowed or required indicator must be set in Customizing for Sales and Distribution. The requirements class is determined using the strategy group and requirements type defined in the material master.
    The req. class parameter, mentioned not very clearly by the SAP help, that allows changing the characteristic values of a material variant during the SO configuration is V_T459K-KONFI and value must be either * or +
    Hint: A quick check can be done In the SO entry: go to the procurement tab and replace your requirement type by KEL, you'll see that configuration is "open" 
    Hope this helps
    Iñaki
    Edited by: InakiGonzalez on May 11, 2009 8:08 PM
    Edited by: InakiGonzalez on May 11, 2009 8:15 PM

  • Clearing Graphics and Sprites problem

    Thanks to Andrei1 for his help previously. Another problem in the same application. Just having problem clearing sprites and graphics. Commented out the clear statements below. Ends up showing nothing. Do I need to create a separate function for initial and then updated values?? Thanks in advance for any help. Hope the code is not to long.

    I think you need to listen to CHANGE event on user input items. Events may be different though:
    ComboBox - CHANGE,
    InputText - has CHANGE or TextEvent.TEXT_INPUT - depending on your needs
    CheckBox and RadioButton dispatch CHANGE event
    So the code can be as following:
    import flash.display.Sprite;
    import flash.geom.Point;
    stop();
    //Set up global variables
    //Set initial selectable Values
    rbMonth.selected = true;
    rbRisk1.selected = true;
    rbYears10.selected = true;
    // declare color of graph
    var graphColor:uint = 0xCC6600;
    //Set variable Group Names
    var timeValue:Object = rbMonth.group;
    var riskValue:Object = rbRisk1.group;
    var yearsValue:Object = rbYears10.group;
    var answerCurr:Array = new Array();
    // it may array of points
    var points:Array = new Array();
    var gr:Graphics = this.graphics;
    gr.lineStyle(1, graphColor, 0.5);
    var i:int = 0;
    // no need for enter frame event listeners
    //addEventListener(Event.ENTER_FRAME, initSum);
    //addEventListener(Event.ENTER_FRAME, drawPoints);
    // add change or other corresponding events to UI
    num2.addEventListener(Event.CHANGE, drawPoints);
    num1.addEventListener(Event.CHANGE, drawPoints);
    timeValue.addEventListener(Event.CHANGE, drawPoints);
    riskValue.addEventListener(Event.CHANGE, drawPoints);
    yearsValue.addEventListener(Event.CHANGE, drawPoints);
    // initial settings
    initSum();
    //Calculate initial set values
    function initSum(event:Event = null):void {
         var Dinit:Number = num2.value;
         var Pinit:Number = num1.value;
         var Cinit:Number = (timeValue.selectedData) * Dinit;
         var Rinit:Number = riskValue.selectedData;
         var Yinit:Number = yearsValue.selectedData;
         //Compound Interest P = Starting principal, C = contributions/year, R = interest rate as decimal.
         //P(1+R)Y + C[((1+R)Y+1 - (1+R))/R]
         //Formula converted intoActionscript = P*(Math.pow((1+R), Y)) + C*(((Math.pow((1+R),Y+1)) - (1+R))/R); break formula into separate parts
         var firstPartInit = Pinit * (Math.pow((1 + Rinit), Yinit));
         var secondPartInit = Math.pow((1 + Rinit), Yinit + 1).toFixed(2);
         var thirdPartInit = 1 + Rinit;
         var answerInit = firstPartInit +Cinit * ((secondPartInit - thirdPartInit) / Rinit);
         var answerInitFinal = answerInit.toFixed(0);
         commaCoderInit(answerInitFinal);
         // first call to draw points
         drawPoints();
    //Format initial end result with commas
    function commaCoderInit(yourNum):String {
         var numtoString1:String = new String();
         for (i = 0; i < yourNum.length; i++) {
              if ((yourNum.length-i)%3 == 0 && i != 0) {
                   numtoString1 += ",";
              numtoString1 += yourNum.charAt(i);
         return result1_txt.text = numtoString1 + " €";
    //Draw Current points on graph
    function drawPoints(event:Event = null):void {
         var Dcurr:Number = num2.value;
         var Pcurr:Number = num1.value;
         var Ccurr:Number = (timeValue.selectedData) * Dcurr;
         var Rcurr:Number = riskValue.selectedData;
         var year:Number =  yearsValue.selectedData;
         var firstPartCurr:Number;
         var secondPartCurr:Number;
         var thirdPartCurr:Number;
         //Calculate Max value and ratio
         var firstPartMax:Number;
         var secondPartMax:Number;
         var thirdPartMax:Number;
         var answerMax:Number;
         var ratio:Number;
         var firstPartMax:Number;
         var secondPartMax:Number;
         var thirdPartMax:Number;
         var answerMax:Number;
         var ratio:Number;
         // point sprite
         var point:Point;
         //Create value loop array
         for (i = 0; i <= yearsValue.selectedData; i++) {
              firstPartCurr = Pcurr * (Math.pow((1 + Rcurr), i));
              secondPartCurr = Math.pow((1 + Rcurr), i + 1).toFixed(2);
              thirdPartCurr = 1 + Rcurr;
              answerCurr[i] = firstPartCurr + Ccurr * ((secondPartCurr - thirdPartCurr) / Rcurr);
              //Calculate Max value and ratio
              firstPartMax = Pcurr * (Math.pow((1 + Rcurr), year));
              secondPartMax = Math.pow((1 + Rcurr), year + 1).toFixed(2);
              thirdPartMax = 1 + Rcurr;
              answerMax = firstPartMax + Ccurr * ((secondPartMax - thirdPartMax) / Rcurr);
              ratio = (answerMax).toFixed(0) / 250;
              // now it is Point - not Sprite
              point = new Point(25 + i * (550 / yearsValue.selectedData), 675 - (answerCurr[i] / ratio));
              points.push(point);
         drawLines();
    //Draw initial lines on graph
    function drawLines():void {
         gr.clear();
         gr.moveTo(points[0].x, points[0].y);
         for (i = 0; i < points.length; i++) {
              gr.beginFill(graphColor);
              gr.drawCircle(points[i].x, points[i].y, 3);
              gr.endFill();
              gr.lineTo(points[i].x, points[i].y);

  • Clearing array on button click

    i have a problem in clearing array.
    1. i have a vi witch on a button click add element in array ,and plot the values on graph.
    2. second time when i run vi on graph i get all the values witch i got in first run pluse the values on second run
    2. i want my graph should not plot values i got in first run
    3. if I initialise the shift reg.then at every button click it plots only one point on graph.
    4. I want all the points witch I added in my array at second run
    so please help me
    Shital"

    Ok, so we have an XY graph. Here I've attached two examples of the same approach as earlier (just second one use only one array of x-y pairs to store data). Local variables used only for cleaning graph display BEFORE any new points will be added (after first point you add, it will be also initialized). So this is just for cosmetic reasons
    Attachments:
    Shift_register_array_initialization1.vi ‏46 KB
    Shift_register_array_initialization2.vi ‏43 KB

  • Cannot load newegg web site. have tried clearing cache and cookies

    Newegg.com fails to load nine out of ten time and takes over a minute to load when t succeeds. I have already tried clearing the cache and cookies as suggested in trouble shooting with no improvement in performance.

    Try:
    # Navigating to about:config
    # Searching for "intl.accept_languages"
    # Right click on the matching result and click "Reset".
    Newegg doesn't respond if you send a malformed Accept-Language header.
    There is some plugin that is changing the default value for that header (I'm pretty sure it is, or was, Firefox Sync)

Maybe you are looking for

  • Can an external HD be partitioned into 2: one for OSX and the other for XP?

    As the topic says, i got an external HD to backup all the stuff. But since I use a desktop PC as well as my macbook everyday, it would be nice to use the HD for both of them. If the answer is yes, what program should i use? Thanks in advance.

  • I would like to update my mac from 10.5.8 to v10.6.8. can you help me

    i would like to update my mac from 10.5.8 to v10.6.8. can you help me

  • Convert ntsc to pal

    I want to export my i.phone and Flip videos from i.movie to i.DVD but when I play back the DVD the video is 'jerky'. (They play great in i.Movie) I assume that there is a problem with the frame rate difference, 30 frames imported but I need 25 frames

  • Error importing Layoutset(.configarchive)

    Hi everybody! I have a problem importing two layouts:one is depending on the other.The first one is imported correctly but when i try to import the second one system gives me an error: Errors related to configuration upgrade: ImportExportConfigExcept

  • I dont know how to convert movies or videos into iPod form.

    Okay heres the deal, I have a fifth generation iPod Video and it is as up-to-date as possible. But I dont know how to change videos or movies to iPod format. I also have QuickTime PRO. Someone please help! Thank-you for your time.