Array averaging issues

I have a VI set up which acquires data into an xy graph.  The axes are saved independently.  Currently, when I output the arrays used for my xy graph into a file, it gives the x and y coordinate for each file.  The x-coordinates are ordered appropriately and coordinate appropriately with the y-axis, but repeat with each scan eg...
x   y
0  .2
1  .3
2  .4
3  .5
0  .21
1  .32
2  .4
etc.
What would be the best method of averaging the repeated scans?  Eventually, I will have to differentiate points using a third coordinate (-1, 0, and 1), and I will have to set up this program to be able to handle that, which is a further complication.
I apologize since this seems like it ought to be routine, but I have always had extreme trouble in dealing with arrays in LabView, especially with establishing indices in multidimensional arrays.
Thank you for whatever advice you can provide.
Please find attached my current VI so perhaps you can see better what I mean.
Attachments:
Gate Scanning Decay Curve retriever (beta) with voltage control modification.vi ‏97 KB

First of all, correct code should not slow down significantly, so something else is wrong. You are growing arrays in shift registers without bounds, so this will tax the system after a while. You shoud stram the data ti disk and only accumulate the two fixed size 2D arrays as described below. Atleast you could clear the feedback nodes after each file write in your current implementation. There is also no reason in the world to do EXT and CXT datatypes. Way too much baggage for this application.
Here's a quick draft how you could do the 2D thingy. Just keep two 2D arrays in shift registers and for each data point, increment the element at x,z indices. One array keeps the sum of all elements and the other the count. At the end, just divide the two 2D arrays. Of course you would need to adjust the size of each dimension according to the desired granularity.
Matt G wrote:
(an x axis might read 0, 0.1, 0, 0.3, 0.4, where the third value was not entered). 
Well, a value of zero is not the same as a missing value. How can you tell the difference?
LabVIEW Champion . Do more with less code and in less time .
Attachments:
arrayaveraging2.vi ‏18 KB

Similar Messages

  • BEx report : Time diff HH:MM average Issue

    Hello Guys
    below is my Issue with BEx report.
    I have a table with has d1 and d2 and t1 and t2.
    I want the diff between them in only HH:MM, using any of the function modules.
    I have got the HH:HH value into my DSO.
    Then I converted the HH:HH into HH:MM in the BEx.
    Now my report requirement.
    I want to display the report with yearly , monthly and daily information -
    let say my boss wants to compare Average time ( HH:MM) between June and July of 2007.
    the report should be
    year ++++++++ month ++++++ daily ++++++++ rec#++++++++ diff
    2007++++++++ June++++++++ 01++++++++ 123++++++++ 31.36
    2007++++++++ June++++++++ 01++++++++ 124++++++++ 11.23
    2007++++++++ June ++++++++ 03 ++++++++ 152 ++++++++ 18.21
    2007++++++++ July ++++++++ 01++++++++ 157 ++++++++ 12.27
    2007++++++++ July++++++++ 08 ++++++++ 124 ++++++++ 15.33
    now when you look at the above report layout.....what i want is to display the average time ( diff) for month of june and july.
    so the average time diff of the month of june will be ( total time / record count ). same for july.
    so the result should be for
    JUNE - (32.36 + 11.23 + 18.21) / 3
    JULY - (12.27+15.33) / 2
    also it should convert the decimals (MM) into hours after 60.
    I am getting the sub total for month June as ((32.36 + 11.23 + 18.21) / 3).
    Its not converting the MM in HH even after 60 Min. say for example its showning 40:67. but the correct value should be 41:07
    hope you got my issue.could you please suggest the solution as to how can i get the correct value under the month sub- total.
    thanks,
    pratap.

    Hello venku chittidi ,
    Thanks for the reply.
    But the User wants to display the values in HH:MM instead of MM.
    would it be possible to calcuate HH:MM from HH:HH in the transformation.
    thanks
    pratap.

  • 4D array averaging - I give up....!

    Hi all, 
    This might be a typical Friday afternoon question, but I've been stuck on this now just about all day and rather close to throwing the laptop out of the window. 
    The case is as follow
    * I've sorted 5 markers in a 4D array whereby I have 5 volumes
    * Each volume (marker) contains data 5 datasets in 5 pages 
    * Each dataset is build out of rows and columns of varying lengths (within 10% of each other) but similar amount of columns. 
    * Each columns is another measurement channel
    The amount of markers and repeats as well as measurement duration of markers is variable. 
    I'm now trying to automatically average each channel data (column) with the other relevant channel data within one marker. 
    So, for example, I would like to create an average graph (+ stdev) of channel 1, for each marker. 
    I have attached an example array for reference, I'm using LabVIEW 11.0.1f (yes I know it's acient!) and would really appreciate your help!
    Many thanks
    Patrick
    Solved!
    Go to Solution.
    Attachments:
    4D array question.vi ‏561 KB

    I would suggest building a second array with the labels of each point (V1-P1-C1-D1, V1-P1-C1-D2, etc. You can do this programatically with string functions), not the points themselves. That way, when you manipulate one, manipulate the other likewise, and you will know what you've done.
    Cameron
    To err is human, but to really foul it up requires a computer.
    The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
    Profanity is the one language all programmers know best.
    An expert is someone who has made all the possible mistakes.
    To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):
    LabVIEW Unit 1 - Getting Started
    Learn to Use LabVIEW with MyDAQ

  • Array Manager Issues

    Hi,
    I'm currently using tarantella 3.4 and am trying to get ldap/ad mirroring with the tarantella ens. To do this I need to change some of the attributes in the Global Desktop Security Login Tab within Array Manager. The problem is that when I apply the change and the go back in none of my changes have been saved. I can change other attributes with Array manager and they are saved.
    Any ideas why this is happening?
    TIA
    Dave

    as root:
    ./tarantrella config list you get all attributs
    ./tarantella config edit --<attribute> <value> you can set the ldap/ad attributes. So you see, wether its an Array Manager problem or a service issue.

  • Array Averaging - help!

    So I am using some Measurement Computing hardware in LabView to scan
    some temperatures. The scan VI takes a data reading each time a loop is
    read (which is a few times a second) and this data is sent out in an
    array. The problem is, my data log gets QUITE big after about a minute
    (with so many readings!).
    So I really need to average this data. Since I am new to LabView, I am
    not really quite sure how I can "hold" the data between loops and
    average the data according to a user defined value. That way, each time
    it writes to a text file the value written is the average value.
    How can I go about doing this? I am quite lost - but THANK YOU for helping.
    Steve L

    Hi tbob,
    I included a picture of my VI block diagram to show you a bit of what I was doing. Basically, I replaced the random number generator with the actual scanning temperature VI itself. The dequeing part of the VI is the part that averages it.
    So if I'm understanding you correctly, I should decimate the data into 4 separate arrays and then proceed to average them that way according to your original VI?
    I've included the VI and the library used if you would like to look at it directly as well.
    Thank you for your help,
    Stephen L
    Attachments:
    Das161.llb ‏64 KB
    Temp Averagervi1.vi ‏42 KB
    TemperatureBlockDiagram.JPG ‏169 KB

  • RAID array activation issue in CS2 & XP

    Yes, I still have CS2, which I love, as well as Production Studio. I have used CS2 for years with a RAID array, first striped and now a mirror. The mirror array lasted about 10 months until the motherboard went. eVGA replaced the motherboard with the same model, I fiddled around a bit trying to get my same array up and running, I couldn't figure it out and ended up doing a reinstall (after a couple of weeks of running single drives). Anyway, I keep having to activate my Adobe Suites. I have talked to people (thick accents, maybe in India) three times now; takes a lot of time. I know that there is an issue with CS2 and RAID (XP and CS2 have all of their available updates). I tell them I have RAID. I ask for a patch to avoid the activation issue. I have been told that I "should not be using RAID", that I will "have to reactivate every time I boot" and that I won't be able to run this "without upgrading to CS4". I KNOW that this configuration will work, because it has worked in the past. I vaguely remember a patch when I originally installed.
    I just called the Tech Support number, instead of the activation number. I also got someone with a thick accent who told me that he had no support available for CS2. He wouldn't give me a phone number to call, I asked about a patch and he "doesn't support CS2", end of discussion. He suggested the website. Ugh!
    I am not locked out at this time, but have just done another reactivation. I suspect Adobe will put a stop to repeat activations. I worry about being locked out when I am under the gun trying to finish something. My son is working on a school project for the end of year right now. What can I do? Does anyone know where I can find a patch or talk to someone who will help a CS2 user?
    I LIKE my RAID array. I know that my data is perfectly backed up at all times. I would prefer not to have to break the RAID array into single drives. I chose this MB because of the RAID capability.
    Thanks in advance!

    Thanks Bob. I asked to speak to a supervisor with calls two and three to India, or wherever. One lady said they didn't have a supervisor and then said, well, of course we have supervisors, but they will not be able to help. I guess I could have thrown a fit, but neither was willing to connect me to a supervisor even though I asked. I did find it amusing (in a sad way) that the one lady initially denied that she had a supervisor.
    I then called Customer Support (call number four) and they simply wouldn't talk to me. They don't deal with CS2, didn't want to talk to me at all.
    I guess I'll try India again, next time it locks me out.
    I'll go through old files (again) to see if I saved some kind of patch.
    Thanks again.

  • Mathscript Array Generation Issue

    I am trying to create a script to generate a 2D array.  When I test the script in the Mathscript editor I get the correct answer, but when I implement it in my VI with the same numbers I get a different answer.
    Script:
    function final=grid(X,Xi,deltaX,Y,Yi,deltaY)
    s=X*Y;
    T=zeros(s,2);
    i=1;
    Yy=Yi;
    for k=1:X
    for j=1:Y
    T(i,1)=Xi;
    T(i,2)=Yy;
    Yy=Yy+deltaY;
    i=1+i;
    end
    Xi=Xi+deltaX;
    Yy=Yi;
    end
    final=T;
    Using the following grid(3,.5,1,3,.5,1) I get the answer I want
    ans =
               0.5      0.5    
               0.5      1.5    
               0.5      2.5    
               1.5      0.5    
               1.5      1.5    
               1.5      2.5    
               2.5      0.5    
               2.5      1.5    
               2.5      2.5    
    However I get a much larger matrix when I use it in my VI (attached).  Any help appreicated.
    Attachments:
    Array Creation.vi ‏24 KB

    The VI does not produce any errors and I have no broken arrow on my file.  I will re-attach the VI just in case I uploaded an earlier edition.   The issue is mainly that I am trying to produce the following array.
              0.5      0.5    
               0.5      1.5    
               0.5      2.5    
               1.5      0.5    
               1.5      1.5    
               1.5      2.5    
               2.5      0.5    
               2.5      1.5    
               2.5      2.5    
    However, when I run the code I get a 2 x 27 (Array Creation Pic)  array not a 2 x 9 (Array Generation Pic).
    Attachments:
    Array Creation.vi ‏73 KB
    Array Creation pic.PNG ‏76 KB
    Array Generation.PNG ‏81 KB

  • Arrays.sort() issue when Numbers are a string!

    Hey guys -- here is my problem.
    I am working on a TOP TEN SCORES mechanism for a trivia game. I have read in the score and the players name from a file. SO I have 2 different arrays topScores[] and topNames[] ---
    Now if someone plays the game and has a higher score than the lowest score, they get to put their score and name in the file and replace the low score.
    HOWEVER -- I do not know how to sort topSCORES[] and then make whatever sorted changes apply also to the topNAMES[] array.
    SO I thought - HEY I will concatenate the topScores and topNames into a single String array. And then SORT! This sounded like a great idea until I realized that the following will happen:
    100 tvance (first one)
    1000 dvance (second score)
    250 danderson (third score) !!!
    See my problem? When I sort this way - it is sorting alphabetically so it will put a 1000 score before a 200-900 score! ---
    **I hope I explained this adequately -- can someone help? Is there a way to sort the topScores array and have it also change the order of the topNames array as well?

    Create a new class - HighScore, which has a highScore and a name?Yup. This technique even has a name: object-oriented programming!
    Demo:
    import java.util.*;
    public final class HighScore implements Comparable<HighScore> {
        private final int score;
        private final String name;
        public HighScore(int score, String name) {
            if (name == null)
                throw new NullPointerException();
            this.score = score;
            this.name = name;
        public int getScore() {
            return score;
        public String getName() {
            return name;
        public int compareTo(HighScore that) {
            if (this.score < that.score)
                return -1;
            else if (this.score > that.score)
                return +1;
            else
                return this.name.compareTo(that.name);
        public boolean equals(Object obj) {
            if (this == obj)
                return true;
            else if (obj instanceof HighScore) {
                HighScore that = (HighScore) obj;
                return this.score == that.score && this.name == that.name;
            } else
                return false;
        public int hashCode() {
            return score ^ name.hashCode();
        public String toString() {
            return score + " " + name;
        //demo
        public static void main(String[] args) {
            HighScore[] top = {
                new HighScore(250, "danderson"),
                new HighScore(1000, "dvance"),
                new HighScore(100, "dvance")
            Arrays.sort(top);
            for(int i=0; i<top.length; ++i) {
                System.out.println(top);
    If you are using an older version of Java (1.4 or earlier), the generics won't be
    recognized. In that case the class definition would begin:
    public final class HighScore implements Comparable {And the compareTo method would begin:
    public int compareTo(Object obj) {
        HighScore that = (HighScore) obj;Good luck!

  • Moving average issue

    I found the moving average of material display on mm03 is wrong, I've found that the material ever changed the cost through mr21 on 10/2008, this is correct. But current period is incorrect 02/2009. And after 10.2008, there have two goods receipts, but the price is OK, the moving average should be no problem, but why the moving average is incorrect. Thanks!

    And I found there have a "RE" type of document in MR51. the posting date is 31.12.2008. the amount exactly same as the total value in MM03. What's wrong. Thanks!

  • Powershell Array Export Issues

    Hey everyone! So I might just be going about this the wrong way but here's my issue. The script functions as I need it to however, when I export the values to my .csv, the columns are in the wrong order than the way I think they should be. Here's what I've
    got:
    $list = Get-content targets.txt
    Foreach($_ in $list) {
    $SAM = Get-RegValue -ComputerName $_ -Key Software\Microsoft\Windows\CurrentVersion\Authentication\LogonUI -Value LastLoggedOnSAMUser
    $User = Get-RegValue -ComputerName $_ -Key Software\Microsoft\Windows\CurrentVersion\Authentication\LogonUI -Value LastLoggedOnUser
    @('Name','LastUserAccessed','LastUserLoggedOn')
    New-Object PSObject -Property @{
    Name = ($SAM).ComputerName
    LastUserAccessed = ($User).Data
    LastUserLoggedOn = ($SAM).Data
    } | Export-csv Results.csv -notypeinformation -append}
    I would like it to read Name, LastUserAccessed, and LastUserLoggedOn but it comes out to be LastUserAccessed, Name, LastUserLoggedOn. Any ideas as to why this is happening? Thanks in advance!

    Okay, then instead of using 'New-Object PsObject -Property', use [pscustomobject].
    http://blogs.interfacett.com/powershell-v3-object-creation-accelerator
    EDIT: Or you can just use [ordered] if you'd prefer:
    http://stackoverflow.com/questions/7802406/use-cases-of-ordered-the-new-powershell-3-0-feature
    Don't retire TechNet! -
    (Don't give up yet - 13,085+ strong and growing)

  • Image Array , GUI Issue

    I am currently trying to insert a 20X20 image a specific spot on an array spot[X][Y], but do not know how to get them in the array.
    Can anyone help me?
    I am using JPanel and want the images to be displayed within the GUI.

    AWebster wrote:
    How would i be able to do this? By reading the Sun Swing tutorials JLabel section and by playing with JLabels and ImageIcons first before trying to incorporating them into your main application.
    And sorry im a Beginner, but would this mean i would have to make 100 separate JLabels to fill the 10X10 grid for the array?Yes, you'd have to make 100 JLabel objects, but not 100 separate JLabel variables as all the JLabel objects would be held in a single 10 by 10 array.
    Is this a memory game application?

  • OS X array formatting issues

    This works on a the PC running windows nt in my comp Sci Class but not at home on my mac.
    This is a simple program I am writing for my comp sci HW. The purpose of this app is to print out a 2D array that forms a alphabetical letter composed of that letter. I wil end up doin the whole alphabet but for now here is A and B. What I can't seem to figure out is why the col will not print to the right? it doesn't seem to read num[row][rows-1]='B', it runs but it just puts that in the position [1] column instead of the [rows-1] column. Any help would be greatly appreciated.
    public class all
         public static void main(String[] args){
         int b=3;
         int rows=100;
         int col;
         int row;
         while(b==3)
              rows=Keyin.inInt("Input an odd # between 6 and 20");
              if((rows>6)&&(rows<20)&&(rows%2!=0))
                   b=2;
              else
                   System.out.println("Learn to count");
              int cols=rows;
              char num[][]=new char[rows][cols];
    //A
         int split=(rows/2);
              for(row=0;row<rows;row++)
                   for(col=0;col<cols;col++)
                   num[row][col]=0;
                   System.out.print(num[row][col]+" ");
                   System.out.println("");
              for(row=0;row<rows;row++)
                   for(col=0;col<cols;col++)
                        num[0][col]='A';
                        num[col][0]='A';
                        num[split][col]='A';
                        num[row][rows-1]='A';
              for(row=0;row<rows;row++)
                   for(col=0;col<cols;col++)
                        System.out.print(num[row][col]);
                   System.out.println("");
    //B
              for(row=0;row<rows;row++)
                   for(col=0;col<cols;col++)
                   num[row][col]=0;
              for(row=1;row<rows;row++)
                   for(col=1;col<cols;col++)
                        int top=1;
                        if((row>=1)&&(row<split)||(row>split)&&(row<rows-1))
                             num[row][rows-1]='B';
                        else
                             num[col][0]='B';
                             num[split][col-1]='B';
                             num[0][col-1]='B';
                             //Bottom
                             num[rows-1][col-1]='B';
              for(row=0;row<rows;row++)
                   for(col=0;col<cols;col++)
                        System.out.print(num[row][col]);
                   System.out.println("");
    [/code]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Your problem is that the mac doesn't treat ASCII code 0 as a space.

  • Array Access Issues

    I have the following array which is a set of 4 multipliers (Direction)
    private int dirMult[][] = new int[][]{{0,1},{0,-1},{1,0},{-1,0}};I am accessing it as follows, where it runs succesfully 2 times, before givin an array out of bounds error.
    //Apply direction multipliers
    for (int M = 0; M <= 3; M++) {
    //Throws Exceotion Below this line on 2nd access
    xMult = dirMult[1][M];
    yMult = dirMult[2][M];
    System.out.println("Multipliers X: " + xMult + " Y: " + yMult);
    moveList.add(super.generateMoves(super.X, super.Y, xMult, yMult, distance));
    }I'm not sure If i configured the array correctly in the first place, it jumps from running {0,1} to {-1,0}. It might be the access methods are wrong. Could someone point out the right syntax to me? Cheers.

    would it be more appropriate to use .length??
    for(int i = 0;i<arr.length;i++)
         for(int j = 0;j<arr.length;j++)
              System.out.println("i: "+i+" j: "+j+" is " +arr[i][j]);

  • Array Expander Issues.

    Hi there ...
    this is how I am adding stuff.
    class CallRecordInfo {
      String from;
      String to;
      double duration;
      CallRecordInfo(String f, String t, double d) {
        from = f;
        to = t;
        duration = d;
    public class testReader{
         int CRdbSize = 2;//CRdbSize = Call Records Database Size ...
           int numRecords = 0; // number of entries in CDdb array
           CallRecordInfo CRdb[] = new CallRecordInfo[CRdbSize];
           void addCallRecord(String from, String to, double dur) {
           boolean LimitReached = (numRecords == CRdbSize);
           if (LimitReached)
                                       int tsize = CRdb.length+1;
                                    CallRecordInfo tempCRdb[] = new CallRecordInfo[tsize];
                                    System.arraycopy(CRdb, 0, tempCRdb, 0, CRdb.length);
                                    CRdb = tempCRdb;
                                      CRdb[numRecords] = new CallRecordInfo(from, to, dur);
                                        numRecords++;
                                        numRecords = numRecords-1;     
         else {
                       CRdb[numRecords] = new CallRecordInfo(from, to, dur);
                         numRecords++;          
        }okay .. basically I don't know how long the array will be hence, I did the array expanding code as you can see. I have another method (called find) to search for records by "From". Initially I have 11 sets of record. So if I set the int CRdbSize above 11. The find method works properly. However if its below 11 which is when the boolean kicks in to expand the array, I think the array gets jumbled up or something, as then on calling find method, it doesn't return the right values.
    I understand the error is when I'm copying the array, but I'm not sure what it is.
    Secondly, I tried to achieve similar result using vector. However like the Class CallRecordInfo has been cast to the array, I don't know how to do it for the vector hence be able to search for the values.
    Any suggestions? thank you :)

    hi, thank you everyone for helping me out. I never noticed that I forgot to update "CRdbSize", how silly! ... However, I was wondering about the ArrayList that you suggested. How would I initialise it?
    If i write something like ArrayList <CallRecordInfo> db = new ArrayList(); Then I get all sorts of errors. I'm sorry for the dumb question, I'm just not use to ArrayList as yet. :( ..

  • YTD average issue

    Hi There,
    I setup Dynamic Time Series YTD, it works correctly for sum aggregation, however, for example, I have employee count per month, in this case, it should be average of sum of employee,
    Jan Feb Mar YTD (Mar)
    2 3 4
    It should be (Jan + Feb + Mar)/3 = 3, however the YTD (Mar) number is not showing correctly, I tag "Total Employee" as TB Average.
    Anything I am doing wrong here?

    I check tech reference:
    "Oracle recommends that you avoid assigning time balance properties (First, Last, Average, Skip Missing) to members set for dynamic calculations if you plan to use these members in Dynamic Time Series calculations. Doing so may retrieve incorrect values for the parent members in your accounts dimension."
    Is this the reason? If this is the case, then how do we handle YTD for employee count?

Maybe you are looking for