Mean-row of 2D array?

Hello,
[LabView 6.0.2]
There's a VI a miss in LabView, but perhaps I just didn't find it:
I'm getting back a 2D array outside of a For-loop; the size of each
dimension is not known explicitly in advance.
I would like to calculate the mean-row of the array (Sum of rows /
number of rows).
It's not difficult, but I did not found any standard VI performing that!
Does it exist? The method I use instead is just another For-loop, but I
would be surprised if it has not been foreseen by the implementors.
Thanks in advance,
Pierre Chatelier

I don't think there is a built-in function that explicitly does what you are asking for, but you shouldn't need a seperate for loop to do the processing.
I assume that because the 2D loop is coming from a FOR loop that there is probibly something (acquisition routine?) inside the loop that is generating a 1D array (the rows in your output). This 1D array is then accumulated into a 2D array at the border of the FOR loop.
If this is so, all you have to do is sum the elements of each 1D array inside the loop and divide the result by the N value for the loop. You can then do whatever you need to do to return the calculated results in the desired form.
In general look for times in which you have two consecutive FOR loops that are executing the same number of
times. Very often you can simplify the code by consolidating the functions into a single loop.
If you post your code (in V6.0 format) I'll look at it for you and show you what I mean.
Mike...
Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion
"... after all, He's not a tame lion..."
Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

Similar Messages

  • How to increase the number of rows in the array as needed

     hello LV
    I need advice following
    1. To the sine signal of 100 data (100 sampling) to sort 250 rows in the array. It changes the sine signal in the plane that time.
    2. To set up a new row by external trigger signal.
    Thank you

    Hi Nusorn,
    Your question makes little to no sense. Could you explain further, perhaps send some example code of what you have done so far?
    Rgs,
    Lucither
    "Everything should be made as simple as possible but no simpler"

  • Delete unwanted rows in 2D array when not knowing the index of which to delete

    Hi!
    I am kind of new to Labview and I hope that someone can help me with my problem.
    First I import a spreadsheet from Excel into a 2-D array of string. For each row in the array I then want to compare the data in a specific column (which is a date (time stamp)) with today's date. Rows containing a date with lower number than today's date I want to put into a new array and the rest I have no need for.
    I have succeeded in creating a time stamp for today's date so that it is consistent with the Excel time stamp. But for the comparing and creating a new array part I have no idea about how to do it. I have tried numerous ways with no luck at all (probably because I don't understand all of the VIs that I need to use).
    Happy for all help that I can get!
    Solved!
    Go to Solution.

    You're on the right track! (although your attempt will only list the datetime values)
    What you'll need to add/change is the resulting array need to be connected to the loop as Shift register (with an initial empty array), and in the Case you'll either use Build array to add the current line or send the unmodified through.
    You'll probably want to send the full array through and not only the datetime.
    You'll probably need some tweak to only use date, but similar to this:
    /Y
    LabVIEW 8.2 - 2014
    "Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
    G# - Free award winning reference based OOP for LV

  • Re: Is it possible to change row colors on array fields ors

    HI Martin!
    Yes, it is possible to change row colors on array fields.
    I have attached a PEX (tools.pex) which has an object which changes FillColor
    and PenColor for Arrays. The PEX has it's own test window, so you can try
    various combinations. (There are a few other Objects in the Project which are
    not relevant
    I'm not sure that you can change colors on individual choices in a scroll list.
    I haven't tried playing around with it.
    The test window actually changes the color of scroll lists as well.
    The object keeps track of which rows have changed color, same with pen color, so
    that when you scroll it keeps track of which rows are a different colors.
    The pex is self-contained, just import the file and do a test run.
    Please let me know if you have any problems.
    -later
    -labeaux
    Is it possible to change row colors on array fields or scroll lists?
    I need to create a list field that will allow me to dynamically change the
    fillColor and/or penColor attributes of individual rows. (I just want to
    highlight the rows, and those seem to be the obvious attributes...) It appears
    you can't do that on scroll lists (the elements are list elements, and don't
    have those attributes) and I can't figure out how to do it on an array field
    either. Any ideas for how to accomplish this?
    -Martin ([email protected])

    FreshWebmuse,
    Version 2 of iCal has the "Group Calendar" feature. It was released as part of Mac OS X v10.4, and if you really want/need that feature you will have to upgrade to Tiger.
    ;~)

  • Delete from multiple rows elements from Array

    I have an array that contains about 3700 rows, and 4 columns. Every 37 rows a cycle of data begins. I would like to delete the first row of every cycle of data (i.e. row 1, row 38, row 75, row 111, etc -- until I have deleted every 37th row in the entire array). Then if possible I would like to take an average of rows 2 through 37, 39 through 74, 76 through 110, etc...
    Any help would be greatly appreciated.

    > After I modify the arrrays, I am displaying them both in lab view (in
    > multiple different graphs and a table), and then also using active X
    > to transfer the data to Excel (where is will be re-arranged and
    > plotted accordingly).
    >
    > I indeally need to get an average of the points in the array about
    > every 36 rows, and then display this, since I am looking to track the
    > output decay over time. If you have any suggestions as how I might
    > find and average of every x number of rows in an array, and either
    > input these into another array or a table, that would be greatly
    > appreciated.
    >
    I can't see the original post about the data shape, but if you have a 2D
    array, wire it into a For loop. Use i mod 36 equals 0 to select whether
    you
    add the array to the current total in the shift register, or whether
    you divide the total array by 36 and append it to the averages array,
    then overwrite the total to restart the process. If the rows isn't
    doesn't contain an integer multiple of 36 rows, you need to deal with
    the excess data either ignoring or making an average with a different
    denominator. I'd assume you do this outside the loop.
    Greg McKaskle

  • How to compare rows in 2D array?

    Hi,
    I have a 2D array of binary.
    - I want to compare all rows against each other.
    - Two rows should be compared if they have only one different element.
    - The result of comparison should be a row with the different element assigned as 2 (or any number different from 0, 1).
    - Continue to compare the result rows against each other.
    - Repeat it until no row can be compare (those final rows should be presented).
    Any idea will be appreciated!
    Solved!
    Go to Solution.

    sangquang wrote:
    I have a 2D array of binary.
    "Binary" is not a type. deep down, everything is binary one way or another. What do you actually have?
    sangquang wrote:
    - Two rows should be compared if they have only one different element.
    You have your oder of operations mixed up! You need to compare them first before you know if they have different elements.
    sangquang wrote:
    - The result of comparison should be a row with the different element assigned as 2 (or any number different from 0, 1).
    Please explain
    sangquang wrote:
    - Repeat it until no row can be compare (those final rows should be presented).
    Presented how? To the user? Does that mean all the result of the earlier row comparisons should not be presented? Why not?
    You post makes very little sense. Please attach a simple VI that contains a simple example of your 2D array (make current value default before saving). Then tell us what kind of result you would expect.
    LabVIEW Champion . Do more with less code and in less time .

  • PHP Search for rows given an array of ID's

    Given an arbitrarily large array of ID's, I want to search an Oracle table for each row based on the ID's in said array and return the results. I can't find a decent way to do this, however, as the array can contain thousands upon thousands of ID's. Obviously, "WHERE IN ()" would not work, as the array can be much larger than 1000.
    Initially, I tried to insert all of the ID's into a global temporary table to do an inner join against but I cannot seem to get this to work. I believe the size of the query gets too large? I have been banging my head against the wall on this for a while and all I can find online is the solutions that work for inserting only a relatively small number of rows, "INSERT ALL" for example.
    I can't be the first person in the world who has needed to do a search based on an array of ID's. Can anyone help me?

    I attempted it using 50 ID's using the following syntax:
    $sql = "INSERT ALL";
    foreach ($entityIdList as $entityId)
    $sql .= " INTO TEMP_ENTITY_TABLE (ENTITY_ID) VALUES ('{$entityId}')";
    $sql .= " SELECT 1 FROM DUAL";
    I run this code and get no errors but when I try to fetch the results by using fetchAll("SELECT * FROM TEMP_ENTITY_TABLE") I just get an empty array returned.
    I thought maybe this was due to the rows being deleted prior to the select executing (I did not specify "PRESERVE ROWS" I will note) so I attempted the query in SQLPlus to see what was happening. It was SQLPlus that told me my query was too long (>2499 characters) and failed out. I thought perhaps the query in code was also getting way too long to be an efficient means of inserting the rows.
    Also, the results of the query you posted are:
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    PL/SQL Release 11.2.0.3.0 - Production
    CORE 11.2.0.3.0 Production
    TNS for Linux: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - Production

  • How to delete rows from 2D array in this case...

    Hello. I'm just begging adventure with labview so please for patient. I created a program whitch suppose work in following way:
    2D Input array is array created by FOLDER BROWSING subVI. It works in this way,that browse folder and looking for txt files whose contanins measurment data. In my case subVI founds 4 files,and from theirs headers read information about what kind of data are in file also their's path. In this way is created 2D Input Array. subVI named PLOTS FROM PATHS ARRAY make picture with polar/XY plot. It's create only those plots and legends on one picture as many files(their paths) is setted to the program by output array. I made this subVI in that way and I would not like to change it. 
    My problem is that in even loop (witch check for any change by user) program suppose to relay anly those rows(files) for which checkbox are marked, e.g. marking anly 1 and 4 box, program should chose from input array row 1 and 4 only and pass them to output array,then  PLOTS FROM PATHS ARRAY subVI makes a picture only with 1 and 4 plot and legend only for plot 1 and 4. The best solution would be some relay witch is avtivated by logical signal. It lost to me ideas how to solve it, I'm just in blaind corner...
    I tried to use delete from array but I don't know how to do use it properly in this program,becease it can be only before or afeter for loop. Below is scan of front panel and also main problem. Please set me up somehow to solve this problem. 
    Regards 
    Solved!
    Go to Solution.
    Attachments:
    plots selector.vi ‏17 KB
    problem.PNG ‏18 KB

    I have attached a vi. Is this the one that you need?
    Anand kumar SP
    Senior Project Engineer
    Soliton Technologies Pvt Ltd
    Attachments:
    plot selector modified.vi ‏14 KB

  • How can I add a new row into an array bases on a1D array

    Hello,
    I build a FieldPoint application with LabView 7.1 RealTime. I've a measurement loop with 1Hz sample rate. I sample 5 channels and put them into a 1D array. Presently I write directly to a cvs file but this I've to cahnge because my loop slows down to 0.2 Hz.
    I want to sample my data the hole day (86400 loops) and save them inside of an array. When the time is over I want write the hole array (table) to the file.
    How I can do this or hoow I can add my 1D array to a new row in my 2D array?
    Thanks
    Thomas
    Thomas

    TomDooley wrote:
    Hello,
    ...I write directly to a cvs file ...my loop slows down to 0.2 Hz
    Writing a series of 5 values to a file should not take so long. There is probably something wrong in the way you are saving your data. May be you should post a simplified version of your vi, so we could see how to improve your code.
    CC
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        

  • How to send a row of an array to a method?

    I am a beginner. I am trying to create an applet with 2-dimentional array of size 4x5. Here is what I have:
    int array [][]=
    {1,2,3,4,5},
    {6,7,8,9,10},
    {11,12,13,14,15},
    {16,17,18,19,20}
    I am trying to send the 3rd row to a method where I want to work with that data.
    Can anybody help me how to SEND the 3rd row?

    I am a beginner. I am trying to create an applet with
    2-dimentional array of size 4x5. Here is what I have:
    int array [][]=
    {1,2,3,4,5},
    {6,7,8,9,10},
    {11,12,13,14,15},
    {16,17,18,19,20}
    I am trying to send the 3rd row to a method where I
    want to work with that data.
    Can anybody help me how to SEND the 3rd row?int[] thirdrow = array[2];

  • Count the number of rows in an array

    Hi there,
    I'm quite new with Labview, maybe somebody can help me.
    I have a .vi that controls two pump with certain ratios (to make a composition gradient). I export the data to an ascii file, which write the displacement of the two pumps in 2 colums. However, the number of rows is related to the ms-counter, and thus related to the processor of the computer. Now I need, at the end of the vi, to get the number of rows written to the ascii file, to do some further calculations. Does anybody know how to do this?!
    Thanks

    You could wire the loop-counter to a variable outside the loop, so you can see the number of iterations (don't forget to add 1).
    You also can use the Array Size-Function. Here you get different outputs, according to the dimensions of the array to get the size of.
    Here you can see what you get if you use this function:
    1D-Array: one value
    2D-Array: array, item 0 = number of rows, item 1 = number of columns
    3D-Array: array, item 0 = number of pages, item 1 = number of rows, item 2 = number of columns
    So if (in your case) you wire a 2D-Array you can use the array-size function, select item 0 of the array you get and you get the number of rows.
    You can also have a look at the attachement.
    Hope it helps.
    Thomas
    Using LV8.0
    Don't be afraid to rate a good answer...
    Attachments:
    ArraySize.vi ‏17 KB

  • How do I store the values in the @D array in the below mentioned VI? Only the last row in the Array is populated with values from the image.

    Hello Guys,
    I am trying to build a sinogram from 180 projection images and I am not able to store the summed values into the array as it is moving the values and then populating all the rows except for the last with ZERO.
    Thanks in advance.
    Attachments:
    sinogram.vi ‏53 KB

    Your loop runs only three times, so all you can possibly populate is 3 rows.
    Typically, you would initialize a shift register with the initialized array, then use replace array subset, feeding the modified array back into the shift register. However, in this case you could just autoindex the 1D array at the output tunnel to build the resulting 2D array.
    Sorry, I am not familiar with sinograms. Do you have a link describing the algorithm?
    LabVIEW Champion . Do more with less code and in less time .

  • Remove repeated row in 2D array

    Hi,
    How can I remove the row for second repeated data in my 2D array regardless of the 2D array size.

    Try this...
    There are many variations possible.
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    RemoveExtraRowsWithDuplicateFirstTwoElements.png ‏31 KB

  • Find row in 2d array

    please help...
    i have 2d array of double and i wanna find specific row an extract to new 2d array.
    My 2d array is:
    100
    31,3
    25,3
    32,1
    25,6
    100
    31,3
    25,3
    32,1
    25,6
    160
    32,4
    25,5
    33,5
    26
    170
    33,2
    25,8
    34,3
    26,2
    100
    33,9
    26
    35,2
    26,4
    160
    32,4
    25,5
    33,5
    26
    160
    32,4
    25,5
    33,5
    26
    100
    31,3
    25,3
    32,1
    25,6
    170
    33,2
    25,8
    34,3
    26,2
    and i wanna find row with numbers 100,160,170 and build new 2d array
    100
    31,3
    25,3
    32,1
    25,6
    160
    32,4
    25,5
    33,5
    26
    170
    33,2
    25,8
    34,3
    26,2
    please help....tnx, tnx
    Solved!
    Go to Solution.

    I guess you should be more specific about your question. If you are planning to find the values that are present in the 1st column then you can use search 1D array and pass the index to index the 2D array so you will get 1D array of row then build the array by finding the element.
    This is what Yamaeda explained
    The best solution is the one you find it by yourself

  • Get the length of column for each row in 2d array

    let say if i declared a 2d array
    int [][]set = new int[5][5];
    if i had finished storing datas in the 2d array like the following
    Columns
    row 0[10][10][10][10][10]
    row 1[20][][][][]
    row 2[15][25][30][][]
    row 3[17][12][][][]
    row 4[10][][][][]
    how do we know the the length of each row of the datas?
    for example row 0 had 5 column data , row 1 got 1 col data, row 3 got 3 columns of data..
    is it possible?
    as what i know int set[1].length() = 5 and is not 1... am i right?

    as what i know int set[1].length() = 5 and is not
    1... am i right?No, there is no parenthesis for the array property length
    Lets suppose you create this 2-D array;-
    int [][]array = {{1,2,3,4},
    {5,6,7,8},
    {10,11,12,13},
    {15,16,17,18} };
    EG:-
    This is array[0][0]= 1;
    This is array[1][0]= 5;
    This is array[2][2]= 12;
    This is array[3][1]= 16;
    int first = array[0].length; // will initialise 'first' to a value of 4

Maybe you are looking for

  • Microsoft Office 2013

    I would be interested to see if anyone has upgraded to Office 2013. Having purchased Office 2010 Home and Business in December, I had eligibility to upgrade to Office 2013. The process went smoothly, even with a 10 minute interruption of the Broadban

  • Is home sharing down?

    Anyone else having trouble with home sharing? It was working fine just yesterday. Today, my AppleTV doesn't see my computer and I can't use AirPlay from my iPhone. I rebooted the AppleTV, which wasn't even able to connect to iTunes. It connected just

  • Programming Standard ( syntaxe )

    Hi guys, I'm looking for a "guidelines" or document which illustrate which is the "java sun or any other good" standard to write codes lines. From starting to correctly place the "{" ...to naming variables... is it: public void FctName() { public voi

  • Accessing html pages outside tomcat server

    Hi I have my images and html pages stored in a directory outside the server. This is because of the WAR file. Other people are developing the html pages and uploading them. The name of the html file is in a mysql table. With the name I have to show t

  • I need Help how to start in Oracle App.

    Please Any one can tell me how I can start with Oracle Applications . Which steps I must go through it ? And if any one in Riyadh Saudi Arabia can help me in that . My email : [email protected] Thanks In Advance , Ibrahim Salameh. Oracle Database Adm