How to average data collected in a loop

Hey everyone,
I am using an interface card to read voltage across a resistor to measure the current through a photodiode.  The VI I made slowly increases the voltage applied across the sample. It takes a starting voltage, increases it by a specified increment, and then takes a series of measurements at that voltage (usually around 200 or 300). I had the program just save all of this data to an external measurement file, where I would then average it in excel.  I had to change the program to measure three variables, and I want to the VI to average the data and then save the average current at each voltage in a measurement file. 
Ex. 
It used to export the data as...
-1     .90
-1     .80
-1     .85
Im trying to get the program to average all of these values and then save it as one data point.
-1     .85
I would like the program to take the 200 or so data points, average them, and then save just the average in a file. 
I usually have about 300 different applied voltages to measure, and with 200 current readings at each it becomes a huge amount of data.
Right now I have the part of the VI that takes the measurements in a while loop, and once the number of loop iterations reaches the specified number of measurements it stops running.  The program would then increase the voltage, and run the measurement loop again.  I got everything else working, I just can't figure out a way to average all the data.
Any help would be greatly appreciated

Alright, I just started using labview last week and i knew that i would have to use shift registers, but when i tried to create one the add shift register option was grayed out.  All i had to do was click on the right or left side of the loop instead of the bottom which is what i had been trying before. 
Thanks for the fast response

Similar Messages

  • How I average data with 78,74,73 and 55 points respectively and end up with an array of 78 points for the average?

    Hi
    As the questions states, how do I average data with 78,74,73 and 55 points respectively and obtain an array of 78 points? 
    When I use the plus vi, Labview somehow produces an array of 55 points when I do the average (see attached vi).
    I have been unlucky in trying to get good results.
    Can anyone help?
    Thank you.
    Attachments:
    average4.vi ‏40 KB

    The add function is polymorphic. It accepts arrays as well as numerics, but you need to understand one thing about array operations in LV. Operations performed on arrays of different sizes will always (I think) work based on the smallest array. For example, if you auto index 2 arrays of different sizes into a for loop, the number of times the loop will run will be the size of the small array. The same is true here - when you wire 2 arrays of different sizes to the add function, only the first N elements of the larger array get processed. The rest are dumped. That's why you get 55 elements.
    Attached is a modification of your VI which shows 2 things:
    The bottom part is your algorithm, only cleaned up. Note how much easier it would be to read now. You should always write clean code. Also, note that I have changed the representation on some of the data from DBL to I32. This is because this is the representation the array function work with and your code had the DBLs coerced for no reason.
    The top part is a different algorithm which should do what you want. Note that like Mike said, the arrays with smaller sizes will have 0s appended at the end, so if you want to avoid that, you will have to modify the last part, where the averaging is done and only divide those columns which are long enough.
    To learn more about LabVIEW, I suggest you try searching this site and google for LabVIEW tutorials. Here and here are a couple you can start with. You can also contact your local NI office and join one of their courses.
    In addition, I suggest you read the LabVIEW style guide and the LabVIEW user manual (Help>>Search the LabVIEW Bookshelf).
    Try to take over the world!
    Attachments:
    average4MOD.vi ‏63 KB

  • How to perform Data Collection on single SFC with QTY = 1 with material lot size 1?

    Dear experts,
    We are working with SFC qty>1 on a relaxed routing. At a given operation we want to collect the data on single quantity; i.e. SFC qty on that operation, where the collection will happen, will be 1.The corresponding material lot size is for ex 10. The operator must be able to collect data on SFC with qty=1 multiple times until the quantities will be consumed. He must be also able to collect other values on the remaining quantities on the same operation with the same DC group or other DC groups. How many times the data must be collected is dependent on the shop order build quantity. The data may be collected several time but not more than the build qty. In other words some specific data will be collected on a qty of a product while others will be collected against remaining quantity. The data collection must be also done in a serialized manner.
    Here's what we have set up so far:
    1) 3 DC groups, each DC group has 3 data fields.
    2) Each data field has the following restrictions:  Required Data Entries = 0 and Optional Data Entries = 1
    3) All DC groups are attached on the same combination of operation\material\routing
    4) we are using relaxed routing
    Process description:
    The operator must be able to collect any data field on single product. For that he will enter the operation where the data collect are attached, he will enter the SFC with qty=1 then he will run the data collection after selecting the appropriate DC Group and entering the needed information. The operator will complete the SFC with qty=1.
    The operator will pick the next product, select the same SFC and enter qty 1 and collect other value against this product.
    Problem is:
    Once the first collection is done on a given SFC with entered qty=1, the system is not allowing the operator to do further collects on the same SFC with qty=1 or any other quantity. He cannot select any DC group from the DC group list. We tried also with the table selection menu on the DC Group list but nothing can be selected.
    So we tried to play around with the DC group definitions as follows:
    A) we set Required Data Entries = 0 and Optional Data Entries = 10. Still the operator was not able to select any DC group after collecting data the first time. We tried to reopen the pod and list again. But we get the same blocking behavior.
    B) we set Required Data Entries = 10 and Optional Data Entries = 1. The operator was able to select the DC group after collecting data the first time. BUT operator must enter the data fields 10 times on one SFC quantity, which is not what we want. Besides again he cannot collect other information on remaining quantities on the same operation.
    C) There's an option to serialize the SFC before reaching the operation where the collection is happening, then merging ofter complete. Automation is needed here; hence customization. We are highly avoiding customization now, since we expect the data collect to work well on single quantities even when the main SFC has qty>1
    Questions:
    1) Are we missing any kind of further configuration\setup?
    2) Or the current system design does not allow collecting data on single quantities of an SFC which main quantity is greater than 1?
    3) Looking at this link Approaches to Collection of Data - SAP Manufacturing Execution (SAP ME) - SAP Library, there's nothing mentioned about same SFC number with multiple quantities!!!
    We are using SAP ME 15.0.3.0.
    Thanks in advance for your help
    Ali

    Ali
    to collect data for the same SFC multiple times, your system rule "Allow Multiple Data Collection" needs to be set to true for the site.
    Stuart

  • How to avoid data selection inside the loop?

    Hello Experts,
    I am working on one performance item and I have already applied some changes to the original version.
    Now, If I compare my new program with old program, I have good improvement in performance. I am checking if I can do anything on statements that are top on the below list. I think 40% for Modify statement is acceptable after my research (Below run is updating around 20M records which is real time volume for this application).
    As we can see 34% of run time to going for one SELECT query on custom table. Take a look at below high level flow of my program to understand above select query.
    1. Select data from ZABC
    2. Select data from Variant Table (Var1, Var2, Var3 etc.., 12 in real time)
    3. Loop Variant Table
    4. Select data from X, Y, Z table for Var<n>.
    5. Populate final internal table from ZABC, X, Y and Z table
    6. Modify ZTABLE with Final Internal table data
    7. End Loop on Variant Table
    As described in the flow of the program, ZABC table data is common for all the variants and need not to fetch multiple times. Hence I am doing it only once in my program. Below is that select query:
    select rrcty ryear rbukrs racct rcntr sum( amt1) as amt1  "Like I have 32 amount fields in original query
               from zabc
                into table i_zabc
                where ryear in r_year    " Two records in ranges with I and EQ
                and rvers = '001'
                and rrcty in r_rrcty        "Three records in ranges with I and EQ
                and rldnr = 'DT'
                group by rrcty ryear rbukrs racct rcntr
                order by rrcty ryear rbukrs racct rcntr.
    ZABC table is again having huge volume of data and we are fetching millions of records with above query. That is primary reason to take long time. May be that is okay as I am already using Indexes of this table. But, I am not comfortable with it as it can reach max. memory point and through run time error. Fetch Cursor is one reliable option that I can see here, but with that, I should move ZABC selection inside the variant loop which can cause fetching ZABC data 12 times (Let me know If I am missing anything here).
    Now, third statement in my trace results, with 10% of overall time is this:
    loop at i_abc assigning <fs_abc>. 
    loop at i_table assigning <fs_table> where low <= <fs_abc>-racct and high >= <fs_abc>-racct. 
    endloop. 
    endloop. 
    6 million executions with this complex WHERE condition is causing this statement to get 3rd position in trace results. I tried below two options which are, I think, taking even more time - (I am still monitoring these options)
    1) Removed WHERE condition on LOW, HIGH and applied filter inside the loop.
    2) Removed WHERE condition on HIGH only and applied filter inside the loop.
    Any suggestions on how to proceed with ZABC selection and I_TABLE loop.
    Let me know if you have any questions on above compose.

    Since I looked at this case before, let me try some quick suggestions:
    Is table ZABC related to table X, Y and/or Z and can the selection be limited by applying those 12 selection variants?
    If yes, try a join select involving these tables that could make your step 1 obsolete and replace steps 4 and 5.
    This might also get rid of the "loop inside loop" problem. Generally, make sure that the inner table is declared as a sorted table with a key that consists of the fields as used in the WHERE-condition of the inner loop. Use secondary keys for internal tables if your ABAP release permits and the task at hand warrants it.
    Finally, look at PACKAGE SIZE option for the (join) select to reduce memory consumption.
    Thomas

  • [JAVA] How to input data collected in a table

    Hello!
    I'm writing a program that monitors the signal of a sensor in a chart. Now I want to insert into a table of data collected by the sensor using a JTable.The problem is that if I run the program, data are not included in the table.
    Where did I go wrong?
    Here's part of the source code.
    ArrayList<Data> datiArray = new ArrayList<Data>();
    DataTableModel dtm= new DataTableModel(datiArray);
    public class DataTableModel extends AbstractTableModel {
        private ArrayList<Data> datiArray;    // <---- Il table model ha la collezione
        public DataTableModel(ArrayList<Data> datiArray) {
            this.datiArray=datiArray;
        public void addData(Data d) {
            datiArray.add(d);
    int row = datiArray.size()-1;
    fireTableRowsInserted(row,row);
             private String colName[] = {"Time", "G-value" };
            public String getColumnName(int col) {
                return colName[col];
            public int getRowCount() {
                return datiArray.size();
            public int getColumnCount() {
                return 2;
            public boolean isCellEditable(int row, int col) {
                return false;
              public Class getColumnClass(int c) {
              return (c == 0) ? Long.class : Double.class;
    public Object getValueAt(int row, int column) {
            Data d = datiArray.get(row);
            switch (column) {
                case 0: return dati.getTime();
                case 1: return dati.getGvalue();
            return null;
        private class Data  {
            public long time;
            public double gvalue;
            public Data(long time, double gvalue) {
                this.tempo = tempo;
                          this.gvalue = gvalue;
    public long getTime() { return time; }
        public double getGvalue() { return gvalue; }
    RecordButtonAction
        private void recordButtonActionPerformed(java.awt.event.ActionEvent evt) {                                            
            int i=0;
    int j= graphView.getSampleTime();
    int k=graphView.getIndexMax();
    System.out.println(j);
    System.out.println(k);
            while(i<k){
    Data dr= new Data(graphView.getTime(i),graphView.getGvalue(i));
    //datiArray.add(dr);
    dtm.addData(dr);
    //these System.out.println are served to me to check if the values were actually included in the class Data and DataTableModel
    System.out.print(graphView.getTime(i));
    System.out.println("/t"+graphView.getGvalue(i));
    System.out.println(dr.getTime());
    System.out.println(dtm.getValueAt(i ,1 ));
            i=i+j;
            readyRecord = false;
    Sorry for my bad English.

    Please don't cross-post the same question in multiple forums. Especially since you've already been given directions as to how to ask the question smartly.

  • How to enforce data collection

    Hi everybody,
    how can I enforce data collection at a specific operation? I am using the integrated POD showing the data to be collected in one part of the window. The data collection itself works fine, but it is merely optional. I can complete the operation without a warning.
    So, where is the hook or rule that I need to set up in order to check whether data collection has been done before completion of the operation?
    Georg

    Hello,
    Please chec k the link below:
    http://help.sap.com/saphelp_me52/helpdata/EN/d7/f7f0be3fec4a31bec083a035eb2423/content.htm
    this explains activity CT500,
    This activity deals with the checking of component, making them as mandatory to assembly etc.
    you can change for the CT500 and CT500_RICH activities in Activity Maintenance:
    On POD you have to use these activities.
    Note: The system executes all code associated with a hook point in the same database transaction. For hook points within POD pushbutton activities, the transaction includes a single pushbutton activity, such as Start (PR500). If the hook point activity fails, the system rolls back, or cancels, the entire transaction. For example, in the figure in Site Level Hook Points, if you associate Check Configuration (CT520) with the POST_START hook point and the components have not been assembled, the system rolls back the Start as well. This is true for all hook points
    br,
    Pushkar

  • How to output data outtside a for loop every 10 iterations​?

    Hi friends,
    does any body help me to sort out this problem?
    please check the attchement for my vi.
    all i want is output data from inside for loop to outside for loop every 10 iterations. please do not use local variable.
    Many thanks
    dan
    Attachments:
    output.vi ‏16 KB

    Hi Dan,
    I am not sure what you want to do every 10 iterations with the value outside, but If you want to update your graph every 10 iterations use the following way:
    If you want to handle the specific value every x iterations outside the loop you could either use queues or notifieres.
    BR,
    ThSa
    Message Edited by ThSa on 08-23-2006 09:05 PM
    http://www.newgistics.com
    Attachments:
    1.png ‏6 KB

  • How to display data collected in main vi to indicators in another vi

    Hi,
    I am collecting data using NI 6251 USB DAQ
    in the main vi but as i have too many controls and indicators on the
    main vi front panel. so i want to display the indicators(graphs) in another vi. i also
    want the vi with the graphs to open automatically. Does any one know how
    i can do this? I would
    really appreciate any help.
    Thanks,
     ygupta
    Solved!
    Go to Solution.

    Hi,
    Search forum for the sub vi concept.
    For your reference i have attached a example.
    you can see procedure for the same on the net.
    regards,
    Shrek
    Attachments:
    graph.zip ‏11 KB

  • How to insert data in tables using loops sql

    Oracle 10.2g
    using Oracle sql*plus
    Table student is
    create table student(id)
    as
    select distinct student_id
    from students_table;now
    desc student; will retrieve
    student
    ======
    Name         Null?    Type
    ===========================
    ID                  VARCHAR2(10)Now creating a sequence
    create sequence st_seq;
    alter table student add column no;
    select * from student
    no       id
    =========
            234
            298
    This is the main part
    There are 100 student id in the table
    now i want to populate the table with sequences using seq.next_val
    how to use a loop to insert 100 auto generated numbers in the table.
    Thank you.
    Expected result
    Select * from student
    no     id
    =========
    1     234
    2     298
    .........Why i am doing this way instead of
    create table student(no,id)
    as
    select st_se.nextval,student_id
    from students;This will cause duplication of upn
    using distinct would throw an error.
    create table student(st_id,id)
    as select distinct st_seq.nextval,academicyear
    from student
    as select distinct st_seq.nextval,academicyear
    ERROR at line 2:
    ORA-02287: sequence number not allowed hereThank you.

    Follow the example:
    SQL> create table students_table (student_id number);
    Table created.
    SQL> insert into students_table values(10);
    1 row created.
    SQL> insert into students_table values(10);
    1 row created.
    SQL> insert into students_table values(20);
    1 row created.
    SQL> insert into students_table values(30);
    1 row created.
    SQL> insert into students_table values(40);
    1 row created.
    SQL>
    SQL> commit;
    Commit complete.
    SQL> select *
    2 from students_table;
    STUDENT_ID
    10
    10
    20
    30
    40
    SQL> create sequence st_seq;
    Sequence created.
    SQL> create table student(no,id)
    2 as
    3 with distinct_table as
    4 (
    5 select distinct student_id
    6 from students_table
    7 order by student_id
    8 )
    9 select st_seq.nextval, student_id
    10 from distinct_table
    11 ;
    Table created.
    SQL> select *
    2 from student;
    NO ID
    1 10
    2 20
    3 30
    4 40
    SQL>
    Cheers,
    Davide

  • Hi, I would like to ask about how to capture data from real time loop.

    Hi,
    Here is some overvier of my project:
    I have done real time control using labview 9.0. I used PID controller.
    In order to optimise this controller, I need to capture data from my sensor(input) and actuator (output).
    1. For example while real time control is running. I need to capture 1000 sample data (sensor(input) and actuator (output)).
    Then I will used these data for PID optimisation on the other loop without intefere my real time loop.
    2. When PID optimisation is completed, I will sent its PID parameter to real time control loop.
    3. These operation is done in parallel.
    Anybody can help me to solve these. Your idea may solve my problem.
    TQ

    Typically you will have to use RT FIFO or Queue communication to avoid any impact to your time critical loop.
    Best regards
    Christian

  • Data Collection in BPC

    Hi,
    How does the Data Collection(UCMON tcode) works in BPC?. Do we have any standard Data Manager Package to do the Data Collection?.How can we achieve this
    Would appreciate your time and response.
    Thanks.

    Hi,
    First, I am not sure what does the tcode that you mentioned does. There is no such code in BPC as far as iam aware.
    Regarding the data collection into BPC application (in other words a cube) -
    You could have a flat file approach -  Upload the flat file into BPC file service using upload data file - and then using standard import data manager package - you could import the data into BPC application. You need to define  and use the BPC transoformations and conversions (if any) in the import process. These are nothing but the files.
    Alternatively, you could also load the data directly from the BW infocube or even from a multi-provider. There is a separate data manager package to do this.
    You could also collect data into BPC through input schedules.
    You have the advantage of triggering the default logic while collecting the data which would apply your business logic on the data before it is saved to the database.
    Hope the above gives some insight to you.
    Thanks

  • Averaging during data collection

    I would like to set up a general vi to take data using three different methods. The first method would be software triggered, and we would use it fro sampling 0.2 Hz on up. The second method is hardware timed, and this would be used for sampling at 100 hz and up. The third method I would like is where I need help. I would like to setup a vi to collect data using software timed, but every time it goes to get a sample, I would like to perform a hardware timed data collection and average the results. For example, I would set the software timed data collection to one second, and every one second I would like to collect 100 samples at 1000 Hz and return the average value of the 100 samples.
    Does anyone have any ideas on how to do thi
    s?
    Christopher Quijano

    I've attached a VI that would do this...
    Michael Aivaliotis
    VI Shots LLC
    Attachments:
    Acquire_N_Scans_Software_&_hardware_timed.vi ‏84 KB

  • How to make the exchange of data between 2 while loop in real time

    hello
    I have 2 while loop
    the 1st while loop includes the data acquisition program
    the 2nd while loop includes the control program
    my question is how to make the exchange of data between 2 while loop in real time
    I tried with the local variable and direct wiring between the 2 while loop
    it does not work (there is a delay)
    Solved!
    Go to Solution.

    Bilalus,
    Queues are only good to transfer data if your application isn't deterministic. Since you are using Real Time, I am assuming that your application requires determinism. If you are using Timed Loops and you use queues to transfer data between your loops, you are losing determinism. In this case, you need to use the RT FIFO functions. 
    Warm Regards,
    William Fernandez
    Applications Engineering
    National Instruments

  • How to Check UPL data collection at Solution Manager

    Hello,
    I had activated UPL data collection as per the document How to Guide –SAP Custom Code Management Usage and Procedure Logging.
    I can check UPL data in my managed system by Report “/SDF/SHOW_UPL"
    But I am not able to get the same data in Solution Manager by this same repot (/SDF/SHOW_UPL).
    When I run this report in solman it show me only Solution manager data.
    How I can read Manage System data in Solman? And what are the check point (for both Solman and Manage system) I need to check for ensuring my UPL date collection is working fine.

    Set up CCLM and the custom code setup and you will be able to view UPL data that way,

  • How do I synchronize data collection on two DT3001 boards?

    I am very new to Labview, and I am trying to find an easy way to synchronize my data collection on two DT3001 boards.  I have tried modifying the AI Continuous Scan example.  This works because I am using all 16 channels on each of my boards.  Unfortunately, I cannot find a way to make both boards collect data beginning at the same time.  Is there an easy way to synchronize both boards to collect data at the same time?  Thank you for your help!

    Hello Kacie,
    I'm not sure how your DT 3001 device and it's drivers LabVIEW functions work, but for synchronizing acquisition on two National Instruments DAQ cards, you need to share a start trigger and sample clock between the two cards by connecting the Real-Time System Integration (RTSI) buses of the cards using a RTSI cable.  This provides dedicated lines for sharing the same sample clock and start trigger, and provides highly accurate hardware-timed synchronization.  Any synchronized starting you program in software in LabVIEW will be software timed.  You can use the sequence structure within LabVIEW to group together different portions of code so that all the configuration is performed for both cards first, and then they are started at the same time.  I know this probably isn't too much help, but I would need to know more about how your DT 3001 device and the AI Continuous Scan example works.  You might be able to find better help on this at Data Translation's website.
    Travis G.
    Applications Engineering
    National Instruments
    www.ni.com/support

Maybe you are looking for

  • Office Web Apps Integration

    Hello, We are looking to deploy Office Web Apps to integrate with Exchange and share files but I do have a few questions before I deploy this technology. With this server installed on premise, will this give the users the ability to access the Web Ap

  • Communicate link between Java and ABAP Stack for https

    I have configured https in both the java and abap stacks (we have a double stack configuration).  Due to our future configuration I have changed the hostnames to fully qualified hostnames per SAP instructions.  The question I have is does anyone know

  • Role for Vendor Evaluation

    Hi experts i'd like to know what are the standard role for vendor evaluation and vendor qualify in SRM EBP 7.0. Regards Andrea

  • How can I use a mySQL database schema with numeric auto increment primary key instead of GUID?

    Hello! I'm using the TestStand "MySQL Insert (NI)" database schema with GUID as primary key. So everything works fine. But I prever using numeric values as primary key, because the database is in conjunction with another database which uses numeric v

  • How to move or migrate whole directories between ASM disk groups?

    Hello everyone! I'm playing around with Oracle ASM and Oracle Database (11g R1), I'm a student. This is just for testing purposes. Computer specifications are: Processor: Intel Pentium 4 HT 3.00 Ghz. RAM Memory: 2 GB. Hard Disk: 250 GB O.S.: Windows