Averaging values in 2-D Array in a circular area

I'm trying to average temperature values in a 2-D array, rectangular coordinates, over a circular area.  Is there a sub-array function that works in polar coordinates, that I could utilize?  Any suggestions would be much appreciated.
Solved!
Go to Solution.

Jeff, I think two loops are enough.
We also should accumulate the sum in a scalar, e.g. as follows, no need to built an array:
It's less pretty compared to my previous post, because we are flying blind, but operated pretty much "in place". This is good for a "code only" solution, where we don't need visual feedback.
Or we could only graph the "counted" points as follows:
Message Edited by altenbach on 07-02-2009 09:14 PM
LabVIEW Champion . Do more with less code and in less time .
Attachments:
CircularAverage2.vi ‏33 KB
CircularAverage2.png ‏19 KB
CircularAverage3.png ‏19 KB

Similar Messages

  • Obtaining average values from 2 - 1d arrays

    I have 2 1d arrays
    The first array contains time values of some length and the second array contains measured values. I would like to find the differences from the measure value array row1 - (minus) row0 / (divide) time array row 1 - (minus) row0 and continue with measure value array row2 - row1/ time array row2 -row1, continuing through the rest of the array.
    I have had any good results yeat.
    Thanks for your help!

    Hi newbie,
    that's basic array math:
    Message Edited by GerdW on 11-12-2007 01:39 PM
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome
    Attachments:
    calc.png ‏2 KB

  • Average values of a 2-D array

    Hi folks,
    quite simple question, just want a simple solution. I've got a 2-D x*y array, need the average value of all the y volume numbers, which means eventually I will have a x*1 1-D array. Is there any simple solution instead of 2 loops? Cheers. 

    Here is an example with a switch for row or column averaging.  The TRUE case of the case statement contains a Transpose 2D Array.
    If you want to average the whole array, you can do this easily by using Reshape Array, then Mean.vi.   Here is that example.
    Message Edited by DFGray on 10-28-2009 07:39 AM
    This account is no longer active. Contact ShadesOfGray for current posts and information.

  • User to enter values and stored as array

    Hi,
    I have some problem with my labs that I would like to clear by doubt.
    I need a user to keyed in a list of age so to calculate the average age. The values entered is stored in into an Array (not arrayList) I have been using ArrayList rather than array. =(
    So I have used a bufferedReader to capture the input the user keyed in. unlike arraylist, I could not create an array without knowing the size of it.
    Also,
    My following code has some proble, when I run the program and enter 99 as the first value input. The system would terminate. However, when I enter other values than 99, the system would not terminate. Do point out my brainless mistake. Thanks alot.
      public static void main(String[] args) {
             // TODO, add your application code
            int num =0;
             int j = 0;
      boolean stop = false;
              int[] arr = new int[200];
               BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
                  while(stop == false){
               try {
             num =  Integer.parseInt(br.readLine());
          } catch (IOException ioe) {}
          if(num == 99){
          stop = true;
        arr[j] = num;
        j++;
        }

    seah_ly wrote:
    I need a user to keyed in a list of age so to calculate the average age. The values entered is stored in into an Array (not arrayList) I have been using ArrayList rather than array. =(Yes you are correct in using an ArrayList, however if arrays are required you could mimic the actions of a growing ArrayList by using an array and initializing a new array with double the size of the old array and copying the old elements to the new array. Note this is exactly what an ArrayList does.
    My following code has some proble, when I run the program and enter 99 as the first value input. The system would terminate. However, when I enter other values than 99, the system would not terminate. Do point out my brainless mistake. Thanks alot.
    if(num == 99){
      stop = true;
    }What do you think this does to the while loop?
    Mel

  • How to find the nearlest value in 1-D array ?

    Hi.. everybody..
    I need to seperate the raw data(1-D) into 2 group of array by the center value and then make the average value in each array. But I also still have the problem about if the center value is not the same of some value in the 1-D array. I cannot use the split function.
    "How to find the nearlest value to the center point that I calculated, in the 1-D array ?"
    Thanks a lot for anybody help

    In a general sense, since I'm not sure what your data values are or how far away your calculated center is from the true value, I would do it one of two ways:
    1) Use a threshold value and scan the array until the threshold is reached (assumes constantly increasing values in the array).
    2) Use either a) round to nearest integer b) round to + Infinity (round up) or c) round to - infinity (round down). If you don't have decimal values, you'll have to devide the values by a power of 10.
    2006 Ultimate LabVIEW G-eek.

  • Calculate the average value

    the data I measured changed rapidly, so i want get the average value of the data
    Do not tell me to use mean.vi , i have already know that.
    and i got an idea which is add the data into an array every time, then sum of all the data value and take the result divide by the number of elements
    but i dont know how to achieve that, anyone can build a simple vi to show me ? thank you
    i have attached my vi which is using mean.vi to calc the average value, you can delete it and using in your way ,  thank you !
    Solved!
    Go to Solution.
    Attachments:
    EN-new.vi ‏274 KB

    Hi I got a similar issue for averaging. I used the mean.vi from the math function but the average is rolling when i run it. I am trying to calculate the average for the data i read to the RT FIFO (which is around 40000 lines).I got the writing part working, however, when i am reading the data, I couldn't get it working. I thought i read the data as a 1-D array, and then pass it to the Mean.vi and then got the result. But seems like the mean is only showing the last data in the array.
    Can someone help me with this??
    Attachments:
    FPGA-vi.png ‏242 KB
    RT-vi.png ‏182 KB
    RT-2mod.vi ‏515 KB

  • How to make labview program to get average value of 200 reading from multimeter (by using loop)

    Hello
    How to make labview program to get average value of 200 reading from multimeter (I using using loop) to read voltage from mulmeter  but I like to get average value of all of 200 reding how can I do that?
    Thanks
    Wee
    Solved!
    Go to Solution.

    Another idea with less programming - take advantage of the "free" array that comes with a Chart - i.e. the  History Data.
    1) Wire your DMM data to a Chart. (You can set the chart to invisible if you don't plan on using it in the GUI).
    2) Set the Chart History Length to 200 (right click on the chart, click on Chart History Length...)
    3) On the block diagram, use the History Data Property Node, wire it to Mean.vi, and you're done.
    Easiest running average ever.
    Message Edited by Broken Arrow on 04-07-2010 11:36 AM
    Richard
    Attachments:
    EasyAvg.jpg ‏8 KB

  • Average Value Returns as Zero

    I'm trying to take a few readings from an oscilloscope. I made a simple VI to test all of the parameters for the oscilloscope and make sure that everything was working before implementing the oscilloscope in a much more elaborate VI. I want to have voltage at a certain level (say, 2 V) then take a reading from the oscilloscope, add that value as a new element in an array. After doing this 100 times the VI will add the average value to a spreadsheet and then increase the voltage (to 2.05 V or something) and take 100 more measurments and average/record them. I was able to take ten sets of 100-sample averages and write them to an array (see notbroken.png) on one file, but when I try to do it in the real program (see broken.png) I check my spreadsheet and each entry is "0.000." Note that I've also created a program that controls the power supply independently and verified that I know how to control it properly; in fact, the only non-zero column is the one which reads the voltage that the program is telling the power supply to output. 
    I've literally written out each step that my "not broken" program does to find the average value and then done the same for the broken program and I can't find a single discrepancy. Any and all help would be greatly appreciated!
    Solved!
    Go to Solution.
    Attachments:
    broken.png ‏53 KB
    notbroken.png ‏42 KB

    vweltin wrote:
    I've literally written out each step that my "not broken" program does to find the average value and then done the same for the broken program and I can't find a single discrepancy. Any and all help would be greatly appreciated!
    Here's an exact analysis.
    Both of your programs are broken, but the one with the FOR loop iterates only 10 times, thus you get arrays with one nonzero value (the last one) when the loop terminates. (Just because the average is nonzero, does not mean it is correct!)
    Your code with the while loop iterates 11 times, but your array only has 10 elements, meaning that in the last iteration you try to replace an element that does not exist and the array remains at all zeroes.
    In both programs, there will never be more than one non-zero element in the array.
    LabVIEW Champion . Do more with less code and in less time .

  • Averaging values of multiple signals seperately

    Hi All,
    I am attempting to create a VI that will average data over a user defined amount of time (via boolean switch). The attached vi collects data once the "collect Data" switch has been triggered, when the test is over the user triggers the "average collected data" switch to get an averaged value. Please see attached VI.
    THis vi works fine for a single signal. However, the ultimate goal is to be able to do this whole process for n-number of sensors throughout my test loop with a final output as an excel file.
    I am pretty sure that I can get the data saved for an excel file but I cant figure out how to get all of the signals averaged seperately and placed into an array.
    Any help will be much appreciated!
    Thanks,
    Stefan
    Attachments:
    Average Collected Data.vi ‏13 KB

    Stefan,
    When you are doing the multiple signal process, will the collection time and averaging be done for all signals simultaneously or will there be separate Collect and Average controls for each channel?
    If all channels will be done simultaneously, you can probably just make your arrays 2D with each channel in a different column. Each iteration of the loop will store the data in the next row (if Collect is True).
    Notes on your VI: 1. You do not need the sequence structure.  Dataflow controls when things happen.  Your VI will work the same without it.
    2. The two case structures wired to Collect Data could be combined into one.
    3. Building an array inside a loop results in frequent memory reallocations.  As the array gets large this will cause the program to slow down and will fragment memory.  A better approach is to allocate memory outside the loop with Initialize Array and use Replace Array Subset inside the loop where the Build Array primitives are now. You will need to add another shift register to keep track of the next index to replace.
    4. Loops should usually have a time delay to prevent them from grabbing all the available CPU cycles.  Once you put in a real data acquisition process, that may provide the delay.
    Lynn

  • Averaging values

    hi,
    i would like to average the last 100 incoming mouse y values.
    my code knowledge is quite limited, but i know i should use a
    ring buffer, because i will onyl want the NEWEST 100 values (so
    value 101 overwrites value 1 in an array)
    any advice on how to start?
    thanks so much,
    aya.

    Try something like:

  • To display average value in a graph

    Hi There,
    In one graph I need to display the duration for each week as per the week range selected and a separate average duration value of the weeks selected.
    Is it possible to develop a query for above average value and use this query in WAD?
    Can anybody help in providing a solution
    Thank you
    Anima

    BI Query data can be fed directly to WAD Charts.
    See below.
    http://help.sap.com/saphelp_nw04/helpdata/en/0c/95c83956852b51e10000000a114084/content.htm

  • How to set variable value in an XML array

    Hi,
    Please let me know how to set the value for a xml array element using assign activity inside a for-each block in BPEL 11g
    I tried to set the variable value for result element using the below condition but i encountered selection failure message
    $outputVariable.payload/ns1:Student['i']/ns1:result or
    $outputVariable.payload/ns1:Student[$i]/ns1:result
    And the xsd used is as below
    <xsd:complexType name="StudentCollection">
    <xsd:sequence>
    <xsd:element name="Student" type="Student" minOccurs="0" maxOccurs="unbounded"/>
    </xsd:sequence>
    </xsd:complexType>
    <xsd:complexType name="Student">
    <xsd:sequence>
    <xsd:element name="Name" type="xsd:string"/>
    <xsd:element name="location" type="xsd:string"/>
    <xsd:element name="mark" type="xsd:string"/>
    <xsd:element name="result" type="xsd:string"/>
    </xsd:sequence>
    </xsd:complexType>
    Thanks,
    Dhana

    Hi,
    At the back of button specify the following parameter:-
    CMD    1        Execute_planning_function
    Planning_function_name  1   xyz
    Var_name     1    variable_name
    var_value      1    blank
    Can also refer to link below:-
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/b0a89464-f697-2910-2ba6-9877e3088954?quicklink=index&overridelayout=true(can refer to page 20)
    http://www.sdn.sap.com/ddc5564a-337d-4cf9-a34e-2dab64df09be/finaldownload/downloadid-a61a6724ba8e7b7fbd9c5df9590ab50d/ddc5564a-337d-4cf9-a34e-2dab64df09be/irj/scn/go/portal/prtroot/docs/library/uuid/f0881371-78a1-2910-f0b8-af3e184929be?quicklink=index&overridelayout=true
    Hope it may help

  • Too many decimals in Average value

    Hi
    I am using Report Builder and the wizard do design a table which i deploy as a .jsp page.
    For some columns in the table I select to display the average values. Some of the values looks fine with one decimal as i want, but some values is displayed with a lot of decimals (about 10) as 164,346666666666666666. I have tried to change the length but without effect. Are there any possibility to decide the number of digits to be shown in the report . Or is i it a bug in Report Builder.

    Go to Property Inspector of the field and choose the right "Format Mask".

  • Creating function to calculate average value

    Hi,
    The below query was successfully return an average value. It returned 1 row.
    SELECT AVG(Volume)
    FROM security
    WHERE
    Type = 'Future' AND
    Rating = 'AAA' AND
    Code = 1 AND
    (Day = ''14-mar-09' OR
    Day = '16-mar-09' OR
    Day = '');
    I tried to use that function on my created function below.
    CREATE OR REPLACE FUNCTION fn_Vol_Average
    ( v_DayLast_1_Week IN DATE,
    v_DayLast_2_Week IN DATE,
    v_DayLast_3_Week IN DATE )
    RETURN NUMBER IS
    v_Vol_Average NUMBER;
    BEGIN
    SELECT AVG(Volume) INTO v_Vol_Average
    FROM security
    WHERE
    Type = 'Future' AND
    Rating = 'AAA' AND
    Code = 1 AND
    (Day = v_DayLast_1_Week OR
    Day = v_DayLast_2_Week OR
    Day = v_DayLast_3_Week);
    RETURN NVL(v_Vol_Average, NULL);
    END;
    I called that function by the following query. it was work, however it return the whole rows. It looks like the function perform the average calculation of each rows on the table.
    Can anyone help me what is going on with the logic?
    select fn_Vol_average('14-mar-09','16-mar-09','')
    from security
    --

    But since your function calculates the average over the whole security table, you wouldn't call this from a select statement which also reads the security table.
    You just want to execute it once.
    declare
       l_vol_average number;
    begin
       l_vol_average := fn_Vol_average('14-mar-09','16-mar-09','');
       dbms_output.put_line(l_vol_average);
    end;By the way, be careful with your date parameters. You should use TO_DATE with a proper format mask to prevent conversion errors.

  • Access values stored in 2D Array in HashMap

    Hi everyone i would like to know how to access values stored in a 2D array inside a HashMap
    Here is a drawing representation of the map.
    So to get the KEYS I just have to execute this code:
    this.allPeople = personInterests.keySet();But how can I get acces to the actual values inside the 2D Array?
    My goal is to create a treeSet and store all the elements of the first array in it, then look at the second array if any new elements are detected add them to the treeset, then third array and so on.
    I tried this code:
    Object[] bands = personInterests.values().toArray();
         for( int i=0; i<bands.length; i++)
              this.allBands.add(bands.toString());
    }But this.allBands.add(bands[i].toString())seems to be the problem, Dealing with a 2D array, this code only return a string representation of the Arrays and not a string representation of their elements.
    Using my logic I tried to execute:
       this.allBands.add(bands[0][i].toString());But i get a ARRAY REQUIRED BUT JAVA.LANG.OBJECT FOUND
    I really don't know the way to go.
    Thanks to anyone that will help.
    Regards, Damien.
    Edited by: Fir3blast on Mar 3, 2010 5:27 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    You'll just need to cast the object to the correct type. This is nothing to do with HashMap at all. If you don't know what that means then your google keywords are "java cast tutorial".

Maybe you are looking for