How to average each element in an array

I have data from a Gage Card that I would like to average.  I am tuning a laser over a 50 mA range and for each 1mA increment in current, I am taking 100 scans.  Each scan consisting of about 200 points.  I cannot average more than 10 shots using the Gagecard so I would like to capture 100 scans, and average them to reduce noise.  Currently, I have my capture vi inside of a for loop which repeats 100 times and each scan writes to a file, but I would like ony 1 scan (the lower noise averaged one) per current increment.  
How can I average each element of 100 arrays and output this to an array?
Thanks for the help 

It sounds like you want to average element 0 across 100 arrays and make that element 0 of the new averaged array.  Then average element 1 across 100 arrays and make that element 1 of the new array ...   ?????
How are you working with your 100 1-D arrays now? 
What you should do is make a 2-D array where one dimension is 100 (for the number of individual arrays) and the other dimension is how many elements are in those 100 1-D arrays.  Then you can use for loops with auto indexing to break the 2-D array down into each row or column, do the average of that array, and autoindex on the other side to build back up into the new 1-D array of averages.  You may need to to a transpose array going into your for loop in case the arrays are indexed in the wrong direction.
Message Edited by Ravens Fan on 01-21-2008 04:26 PM
Attachments:
Example_BD.png ‏6 KB

Similar Messages

  • I want to create an array that goes into a case structure where each element in the array is an individual case and gets done in order

    I want to create an array that goes into a case structure where each element in the array is an individual case and gets done in order. Any ideas, I've been playing with the idea but have had no luck, is this even possible?

    Hi,
    Please check it out the attached Vi.. Is this you need?
    Sasi.
    Certified LabVIEW Associate Developer
    If you can DREAM it, You can DO it - Walt Disney
    Attachments:
    Event.vi ‏11 KB

  • How to delete an  element in an array...(simple way)

    hi,
    Newbie here... please help how to delete an element in an array list?
    there are alot of codes but they're complicated for a newbie like me..
    (simple codes would be better ..:) thank you...

    makk_88 wrote:
    since u want the simple method.....
    just overrite the position of the element that need to be deleted with the next element in the array..
    by doing this, element need to be deleted will not be accessibe..
    i think u got..what i'm saying.
    thnx..Mak,
    Say we wish to delete the second element of an array a[1]. Do you really believe that a[1] = a[2] somehow magically deletes a[1]? I really don't think so Tim.
    Two eggs, minus 1, equals two eggs? Interesting theory, but I think you're probably wrong.
    *@OP:* My advise is just use an ArrayList.
    Cheers. Keith.

  • How to show the elements of an array?

    How to show the elements of an array, when the array size changes every loop?
    It's possible to use node property?
    thanks
    Vicens
    Win XP/ LV7.1
    Attachments:
    show elements.PNG ‏184 KB

    Basically it is (at least in LV8.0). There is a property "Number of Rows" which sets the number of visible rows. If your 1D array is placed horizontally, use "Number of Columns".
    Using LV8.0
    Don't be afraid to rate a good answer...

  • How do I put each element of an array of 30 elements to each slot in a cluster?

    There are 30 columns in a table in an access db file.
    Currently, I have an array of 30 floating point numbers.
    I want to know how to put each of array elements in each slot in a cluster of 30 slots with DB Tools Insert Data VI.

    You can use the array to cluster primitive
    Rodéric L
    Certified LabVIEW Architect

  • How to insert 1 element in 2D array?

    There is an example of how to replace element in 2D array, but I would like to insert (not replace), I use the insert element. it does not work for 2 D array.
    Attachments:
    find_and_map_defect_to_image736X554.vi ‏46 KB

    You need to tell more about what you want done. What exactly does it mean
    to insert into a 2D array? Are you inserting into the row or column or
    both? By that I mean to ask what parts of the array get their indices
    incremented. Then what should happen at the endpoints? If you insert a
    point into one row then that row will have one more element than the others.
    Should the last element in that row be lost or should the other rows get a
    zero appended?
    "trout00" wrote in message
    news:[email protected]..
    > There is an example of how to replace element in 2D array, but I would
    > like to insert (not replace), I use the insert element. it does not
    > work for 2 D array.

  • How to find the elements of an array

    I want to find the number of elements in an array, and I can't find the tutorial that shows how to find it. If anyone could point me in the right direction, it would be greatly appreciated.

    warnerja wrote:
    flounder wrote:
    DrLaszloJamf wrote:
    You mean x.length?<pbs>
    Depends upon your interpretation of "number of elements in the array"
    int[] numbers = new int[10];
    numbers[0] = 42;
    numbers[1] = 666;Number of elements in the array is 2 not 10.
    </pbs>If you used something other than a primitive type for the array element type you could have a case. A value of integer zero for the other elements is still a value, so there are indeed 10 elements there.Even if it were not primitive, every element would have a value. That value would either be null or a reference.

  • How to write each element of a set to the excel sheet?

    I am trying to iterate through each element of the set and write each of them to an excel file? Can Somebody help me to achieve this?
    Code snippet is:
    Iterator<String> nameIterator = names.iterator();
        for(int size = 0;size<names.size();size++){       
      row = mdm_lastLoginDate.createRow(size);
      //cell = row.createCell(1);
      while(nameIterator.hasNext()){
      String setName = nameIterator.next();
      cell = row.createCell(1);
      cell.setCellValue(setName);
      System.out.println("setName:->"+setName);
      mdm_lastLoginDate.autoSizeColumn(size);
    above code prints each element in the console but not getting each value in the excel file. I am only getting the last value.
    Thanks & regards
    Amita

    As already communicated several times to you - please use the correct space for your posts.
    I'll move this thread again to Master Data Management (SAP MDM), however - and for the last time - please get familiar with The SCN Rules of Engagement and note that your account will be disabled if you repeatedly fail to follow them.
    --Vlado (SCN Moderator)

  • Can we change the property of each element of an array using property node or by other methods?

    Hello all,
    Can we change the property of the elements of an array. For example:
    I have an array of combo-boxes. Can i have such a scenario that different combo-boxes of the array will have different items to select an item.
    I am able to set the different "values" in different combo-boxes bu using "to be more specific class" property node.
    But i could not set the different item list in different combo-boxes.
    Please give me the solution.

    Thanks a million dave!!!!!
    I have learnt a very new and innovative thing...
    I just wanna ask you one more question in the above context.
    Can i have listbox or combo-box in a table just like in an excel sheet where we can have listbox by using "data validation" property for different cells having different list.Can i have this in labview. Because for this i have to super-impose the combo-boxes on the table and treat them separately.
    We have to take those combo-box values and put in table and then store it.I have attached one VI to show the scenario.
    And this is the alternative solution of the array problem which u have already given. So please suggest me between the two or any alternative solution.
    Thanks,
    Ankit Madaan
    Attachments:
    Recording _Table.vi ‏19 KB

  • How to add new elements in an array of Objects of Type Figure??

    I have a Figure class which has many attributes(variables). Then I create an array of Figures for example
    Figs[] figures = new Figure[18];
    Later I need to add new Figures to this array at different positions. In my case I have to use the same array.
    Is there any way so I can add new Figure elements to this array??
    If u have an answer to this question, please share with me.
    Thanks
    Amit

    There are many ways to solve this problem, including creating new arrays as needed, and using System.arraycopy() to move things around. However, the best way is to use ArrayList, as discussed above.
    What you cannot do is use toArray() and cast back to String[]. Object[] is not a subclass of String[], even if all of the objects in the Object[] are Strings!
    There are two ways to get around this. Create a String[] and copy the Object[] into it with System.arraycopy, or the easy way, which is to use the toArray(Object[]) method. It allows you to specify by example the array class you wish returned. If the array is large enough, it will populate the array directly, otherwise it will create a new one of the same base class. That means any of the following approaches will work, the final decision is mostly a matter of style:
        // create a zero length array to pass as an exemplar
        public final static String STRING_ARRAY_TYPE[]  new String[0];
        String s[] = (String[]) a.toArray(STRING_ARRAY_TYPE);Or:
        String t[] = new String[a.size()];
        a.toArray(t);Or:
        String t[] = a.toArray(new String[a.size()]);;I prefer the first approach generally, and it avoids any race conditions between the evaluation of the ArrayList size and the toArray; however, since ArrayList methods are not synchronized, you probably should do some synchronizing of your own.
    Hope this helps.

  • How to replace cluster element in an array?

    hi,
    I have understood preferable choice is to initialise array first and replace elements in an array instead of inserting new element in an array e.g. in a while loop.
    So I started to this evaluate since I have an application where I want to read lots of measurements from a txt file and display them in a XY graph. XY graph must show Y value and corresponding X value either red if it is out of range and in green if it is in range. I found a solution to do it with an array of clusters.
    In attached example I have two different methdologies represented. My problem is that upper solution doesn't display content of all measurements. Can somebody tell me what I'm doing wrong ?
    regards,
    petri
    Solved!
    Go to Solution.
    Attachments:
    plot test 3.vi ‏19 KB

    Petri wrote:
    ... using cluster with three elements was a method I found to put red and green dots in one XY graph, eg. Y=coordinateY, X(green)=NaN,X(red)=coordinateX. Perhaps there is a better way to display the data, but I couldn't find it.
    That is an odd thing and makes little sense. Why three? four, five, etc are NOT supported, so what if you want more than one color? (in range, fail high, fail low?). For more detail see the discussion here.
    In any case, reading all these values from a datafile and creating xy plots is trivial. I would recommend to use complex data. a single complex array will graph IM vs RE. For multiple plots, combine them using "build cluster array". No loops needed.
    Here's a quick draft. Of course you need to decide if the data is in columns or rows, etc. so modify as needed.
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    plot2XY.PNG ‏7 KB

  • How to pick random element in 2D array

    This is the contents of my constructor. How is the best way to pick a random element in a 8x8 array and assign it "Q"?
         public DancingQueen()
              board = new char [BOARD_SIZE][BOARD_SIZE];
              for (int i = 0; i < board.length; i++)
                   for (int j = 0; j < board.length; j++)
                        board[i][j] = SPACE;
                   Random generator = new Random();
                   int r = generator.nextInt(8);
                   int c = generator.nextInt(8);     
                   board[r][c] = "Q";

    Better make that 'Q' instead of "Q". The rest is fine though.
    kind regards,
    Jos

  • How to increment an element in an array and put it back in the same array?

    I have an array of values generated by another part of my program. My goal is to count the number of occurences for each integer value in the array and put these values in a new array. This new array will be a histogram of the input array. My approach is to do auto-indexing with a for loop. In the loop I use a "index array" to get the current value of the histogram array and a "replace array subset" to update the array element with "current+1". The problem is that when I wire the output of the "replace array subset" VI back to its input, I get a wire error. I guess I cannot wire it like that, but what should I do? Is there a completely different approach to do this that
    is more elegant?
    Thanks for your help!
    Benoit

    Hi Benoit,
    I believe the thing that's missing is a shift register.
    Right-click on the edge of your "For loop" and select add shift register.
    Wire an initialized array to the shift register left terminal before entering the "for loop". Wire from this same terminal (inside the loop) as the source of the info used in your "index array" and replace array. The results of these two operations (just the way you are doing it now) gets wired to the "right terminal" of the shift register (inside the loop).
    What ever you stuff into the right terminal, gets returned via the left terminal on the next iteration of the loop. When the loop is done, your final array of counts can be accessed by wiring from the "right terminal" (outside the loop).
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • XML element name contains (.) periods, how to access each element value?

    Hi All,
    This is the xml that needs to be processed.
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <com.companyx>
    <person>
    <employee.data>
    <employee.name>mrx</employee.name>
    <employee.number>1001</employee.number>
    </employee.data>
    <employee.data>
    <employee.name>mry</employee.name>
    <employee.number>1002</employee.number>
    </employee.data>
    <employee.data>
    <employee.name>mrz</employee.name>
    <employee.number>1003</employee.number>
    </employee.data>
    <page>0</page>
    </person>
    </com.companyx>
    Please tell me how to access the <employee.name> value of
    the first <employee.data> element.
    An early help is much appreciated.......
    Thanks in Advance,
    Vijay Karthik

    Give this a try... should do the trick
    trace(myXML.person["employee.data"][0]["employee.name"])

  • Flex: how to select each element/instance of a repeater

    I'll explain my problem as brief as possible. I have a variable bandName, the value is String that i get through an API.
    public function haalNaam(selectedChart:Object):String
    var bandName:String = selectedChart.name;
    I use this var in a repeater for a label. This repeater repeats 5 times, so it shows the 5 most hyped artists:
    <repeater>
    <label text="{haalNaam(lastfmCollection.currentItem)}"/>
    </repeater>
    Next, i had to transport the var bandName to another component. I managed to do this with this command:
    var theName = "LastFmApi(this.parentApplication).bandName"
    This code works, but I only manage to get the bandName of the last element in the repeater (5th one). I have no idea how i can receive the names of the artists 1,2,3 or 4. How can i get to those values?

    I made some screenshots to elaborate.
    So these 5 thumbnails are in a repeater. If you click on an artist's name or image, you go to a profile component and i want to post the artists name on that page. With the code i have now i can only take the value from the nameLabel from the last artist (in this case Damien Rice) and show it in the other component.
    Now i should know how i can select the names of every artist, not just the last one. Someone i know said that i can do this like this:
    theName=(event.target as Label).text;
    But i'm not sure on how to implement that.

Maybe you are looking for

  • Creating a removeable subset of the iPhoto Database

    My iPhoto library has grown to the size where I have to make CD/DVD Backups of the photos (and subsequently store the disk images on an external hard drive for further backup safety), just to have enough space to keep Mac OS X running smoothly. Looki

  • Dynamically Set date not changing in schedule Job

    Hi, I have created a report with "Order Date" as one of the parameters on the selection screen. I have created a variant, say 'X' , to set this date parameter dynamiccaly as "Current date - 31 days". I have scheduled this program to run in background

  • Can I add a sata dvd drive to foxconn mcp73m01h1

    Compaq sr5450f product kj383aa#aba,{Personal Information Removed}--motherboard foxconn  mcp73m01h1 has receiver for four (4) sata connections. I assume thta I can use one for an added hard drive --but can I also use one for a sata dvd rw drive?  The

  • SQL Server CLR SharePoint Interface for Sharepoint 2013

    Hello everybody. Is the project http://archive.msdn.microsoft.com/SqlClrSharePoint actual to use with Sharepoint 2013 + SQL Server 2012 SP1? Sergey Vdovin

  • Back Ground Results

    Hi, I have to do syntax checks for all types of programs, I have sheduled the Back Ground job, I have seen the log it says the Job i9s finished,can I see the results of my program ?