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

Similar Messages

  • 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

  • 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

  • Efficient Int32 Array to Boolean Array to Int16 Array

    Have a large array of Int32 (~500,000 elements).
    Each Int32 needs to be parsed into two Int16 arrays: Array 1 is the first 12 bits of the Int32, Array 2 is the second 12 bits of the Int32.
    The method I am using (see attached) works just fine but it is taking a lot of time to run (on a relatively slow, embedded CPU).
    Does anyone have an idea how to make this run faster?
    Solved!
    Go to Solution.
    Attachments:
    Example Code.rtf ‏571 KB

    Red Sox Fanatic wrote:
    Excellent - thanks I'll give it a try!
    Not that you needed more ways to solve this problem, but lots of us on this board are curious about performance and I had a few minutes to throw together a VI to test the timing of a few approaches suggested here, as well as two variations of an additional approach that I like (shown here).  The basic conclusion is that they're all pretty close on my machine (LV 2009).  Splitting a 1-million element array, averaged over 50 times, the approach with 2 ANDs was 20ms.  Using a FOR loop was 21ms.  Using a pair of shifts (shown below) was 17ms.  A variation of this, with a typecast, was much slower, at 35.5ms.
    Attachments:
    2x12 bits from 32.vi ‏19 KB

  • Quick array length question...

    for this part of my code i'm trying to determine the components needed to find the average of my array. I can't seem to find a way to determine the length of my array (how many components it consists of). Every time I keep getting the dereferencing error....I know it's something simple but I just can't seem to get it right. Please help!
    int total = 0, mean = 0, length = 0;
    for(int j=0; j<i; j++)
    total = total + array[j];
    System.out.print(array[j]+" ");
    System.out.print(total);

    Hi Cher,
    This length attribute if any array object will give you the number of components I mean number of elements in that array.
    array.length; rather than array.length();
    This may be helpfull.
    int total = 0, mean = 0, length = 0;
    for(int j=0; j<array.length; j++)
    total = total + array[j];
    System.out.print(array[j]+" ");
    System.out.print(total);>
    Aski

  • Variable number of two dimensional arrays into one big array

    I have a variable number of two dimensional arrays.
    The first dimension is variable, the second dimension is always 7.
    i.e.:
    Object[][] array0 = {
    {"tim", "sanchez", 34, 175.5, "bla", "blub", "[email protected]"},
    {"alice", "smith", 42, 160.0, "la", "bub", "[email protected]"},
    Object[][] array1 = {
    {"john", "sdfs", 34, 15.5, "a", "bl", "[email protected]"},
    {"joe", "smith", 42, 16.0, "a", "bub", "[email protected]"},
    Object[][] arrayi = ...I'm generating these arrays with a for-loop:
         for (int i = 0; i < filter.length; i++) {
              MyClass c = new MyClass(filter);
              //data = c.getData();
    Where "filter" is another array which is filled with information that tells "MyClass" how to fill the arrays.
    "getData()" gives back one of the i number of arrays.
    Now I just need to have everything in one big two dimensional array.
    i.e.:Object[][] arrayComplete = {
    {"tim", "sanchez", 34, 175.5, "bla", "blub", "[email protected]"},
    {"alice", "smith", 42, 160.0, "la", "bub", "[email protected]"},
    {"john", "sdfs", 34, 15.5, "a", "bl", "[email protected]"},
    {"joe", "smith", 42, 16.0, "a", "bub", "[email protected]"},
    Any idea on how to accomplish this? It's blowing my mind right now.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Just brainstorming here:
    Why not put your actual data in a class and store that in a LinkedList (so you know the total number of elements for your multi-dimensional array). Then initalize your multi-dimensional array and populate it? Haven't tested the following, but thinking something along the lines of
    public class MyData {
         //data here
         public Object[] toArray() {
              //something similar to this
              return new Object[] = {"tim", "sanchez", 34, 175.5, "bla", "blub", "[email protected]"};
    LinkedList<MyData> data = new LinkedList<MyData>();
    data.add(mydata1);
    //however many times you need
    Object[][] arrayComplete = new Object[data.size()][7];
    for(int i = 0; i < data.size(); i++) {
         arrayComplete[i] = data.removeFirst().toArray();
    }Another option for knowing how many rows you would need might be using something like:
    int rows = 0;
    rows += array1.length;
    rows += array2.length;
    //etc...But is not entirely useful if you don't know how many variable arrays you have (although reflections might help if the name of the array variable is incremented systematically, someone told me earlier to avoid reflections since it could make debugging a LOT more difficult).
    Edited by: bogdana on Apr 1, 2010 10:38 AM

  • Deletion of arrays during specific time intervals...how to get it working?

    i am trying to calculate the average peak values in a systolic pressure waveform during a specific time interval. for example, every 5 seconds, i want to average out all the peak values in that interval and after calculating the average, i want to delete the array of peak values. however, what i am finding is that the array is always 0 if i use the delete array in my vi. therefore, the average is always NaN, because the array is empty and there is a divide by 0 error....
    what should i do? i have been stuck on it for a long time now, thankyou very much"
    Attachments:
    help.vi ‏57 KB

    It is very difficult to make sense of your diagram, because all the control references are missing, so it is not possible to tell the various data sources apart.
    Where is the data coming from? How do you prevent race conditions between the acquisition and analysis parts?
    Overall, the diagram is overly complicated and very hard to read. For example clearing the array does not require reading the old array, measuring it's length, followed by "delete from array", followed by writing back to the array. Why don't you just wire an empty array to it? Same result! :-)
    You go to tremedous lenght calculating a simple array average, using numerous property reads and indexing arrays inside FOR loops. There is "mean.vi" that does it in one step. (If you only
    have base LabVIEW, it might not be available (?), so use "Sum" and divide by n. No loop needed). To find the largest element in an array, use "Array Max & Min" from the array palette, again in one simple step.
    I would highly recommend going over some LabVIEW tutorials or look at some of the shipped examples. Make yourself familiar with basic programming concepts such as auto-indexing at loop boundaries. An "index array" wired to the loop counter is never needed.
    I suspect that your problem is due to a race condition between acquisition and analysis code, but there is no way to tell unless you include all control references and also the companion VI that gets the raw data from the instrument.
    LabVIEW Champion . Do more with less code and in less time .

  • How to find which disk is faulty in a degraded RAID5 array? Then fix?

    (I already posted a question in an old RAID thread, but I was told people who know the answers don't read old threads... And I checked the Sticky.)
    My 4-disk RAID5 array (the K8N "PC1" machine) suddenly degraded today, and one disk is marked as faulty. The manuals aren't especially helpful in helping to find out which particular disk is faulty, and nothing is pointing out what kind of error it is, or what I should (safely) try...
    Here's from the Event Viewer:
    Quote
    The description for Event ID ( 7 ) in Source ( nvraid ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. You may be able to use the /AUXSOURCE= flag to retrieve this description; see Help and Support for details. The following information is part of the event: .
    From MediaShield:
    nVidia reference boards have a "Disk Alert" utility showing the connector for the faulty disk, which seems like a good start (just follow the cable...). But it doesn't seem like the K8N has anything similar? That MediaShield picture doesn't at least make it 100% clear which of the disks is thrown out of the array.
    Samsung has a DOS program that can test their disks, boot from a floppy I guess. I will download that and see if I can pin-point the disk. But if not, how? And if I find which one is marked faulty, how to find out if it's really faulty or if there is a "glitch" in the RAID routine?

    <F10> at startup gets me into the MediaShield Utility, showing the degraded array.
    It gives info about the three disks in the array, and the one removed:
    Code: [Select]
    Adapt  Channel  Index
      1       0       0
      1       1       1
      2       0       2
      2       1       3 This indicates that the disk marked faulty indeed also is the one connected to the SATA connector with the highest number.
    So I guess I can try removing that disk and see if the machine still starts up, then temporarily put in a 500GB disk I have in an ESATA box (not containing anything useful). Then rebuild the array (for a couple of days?), then try testing the faulty-marked disk with the Samsung HUTIL program.

  • Array.split question

    Hi,
    Curious, can you split a file when using array.split() for a
    carriage return that was loaded using loadVars?
    say my file looked like this:
    John, 23, handsome, blonde
    Mary, 35, pretty, brunette
    myArray[3] = blonde Mary
    is there a way to have it
    myArray[3]= blonde
    myArray[4]= mary
    any help would be great.
    thanks,

    Ya, split a string sorry.
    I've used the loadvars to load a file.
    John, 23, handsome, blonde (line returns w/no comma
    seperator)
    Mary, 35, pretty, brunette
    var myArray:Array = myStr.split(",");
    gives me
    myArray[0] = John
    myArray[1] = 23
    myArray[2] = handsome
    myArray[3] = blonde Mary (here's the problem)
    myArray[4] = 35
    myArray[5] = pretty
    myArray[6] = brunette
    I need to split the string where the file had a carriage
    return/new line.
    Is that possible?
    Thanks,

  • Xor of array elements

    Hello,
    Dose anyone know how to get Exclusive Or (Xor) on array of U8 elements
    in LabVIEW?
    Avivit
    [email protected]

    Avivit Noiman wrote:
    > Hello,
    >
    > Dose anyone know how to get Exclusive Or (Xor) on array of U8 elements
    > in LabVIEW?
    >
    > Avivit
    > [email protected]
    Create a for loop with a shift register. Initialize the shift to zero.
    Feed the array in (let it autoindex) use the XOR function to
    xor the shift with the U8 value, stuff into the shift register.
    This will XOR all the values of the array together, and give a single value
    I think this is what you want.
    Kevin Kent
    Attachments:
    Kevin.Kent.vcf ‏1 KB

  • Finding Array Length

    I was just wondering if i have an array
    double [][][] array = new double [1][2][3];array.length only gives 1, what function can i use to find the size of the other dimensions (2 and 3)? Thanks in advance for any help.

    I'll try and explain this a little better.
    Say array[0].length is 2, then that means that there is only
    array[0][0] and array[0][1].
    If array[0][0] is 4, then that means that there is only
    array[0][0][0], array[0][0][1], array[0][0][2], and array[0][0][3].
    The reason i did array[0][0].length and not array[0][1].length
    in my other post is because they would both return the same
    thing because of the way you declared the array.
    When you dodouble[][] array = new double[2][3];this is making it so that array[0].length is 3 and array[1].length is 3.
    But if you do this (shown in the previous post)
    double[][] aray = {
        { 2.4, 5.6, 6.4 },
        { 1.4 }
    }then array[0].length is 3, but array[1].length is 1.
    Hope this helps.

  • Create tree and store it's value in an array

    I have to create a tree as shown below:
    2--->7-->6-->5-->3
    ---->4
    ---->8
    Here the numbers are the nodes of the tree and --->denotes the connection between them.
    2
    7 8
    6
    5 4
    3
    Another representation
    2 is connected to 7and 8, 7 is connected to 6 and 4, 6 is connected to 5 and then 5 to 3.
    Currently I am able to display the graph as shown in the first diagram but while storing the value, I am facing a problem.
    I have declared a double dimensional array to store the array index.This gives me 2 as a[0][0],7 as[0][1],6 as [0][2],5 as [0][3], 3 as [0][4] and 8 as [0][1] and lower(2nd) 5 as [0][2].
    Now since the timestamps are same for 7 and 8 and that for 6 and 5 so I saved them in the same array location.Instead I want 7 as [0][1][0] and 8 as[0][1][1].
    I am using recursion to built and I knw I cant add a new [] everytime.
    Can any1 of u suggest me how to store my array?
    Thanks
    The display I am trying to show instead coming proper in this windows so ------- means the connection between parent and children.
    Edited by: abheyb on 25 Mar, 2008 5:45 PM

    Hi,
    Here you have to use the pure object oriented concept rather than using procedure oriented(like c).
    Design a user defined class according to your problem that extends with any Collection. For Example. TableCell
    Declare a attribute TableCell tableCell in your class.
    Write the method called addCell(TableCell tableCell)
    and printTablecell()
    In this method you need to follow the recursion concept.
    Design as u need...! If you are designing for binary tree, then you need to declare two attribute called tableCell1 and tableCell2
    Bye.....!

  • Help with a FOR loop and an object array

    I need to make a for loop that takes an array of objects that contain the parameters year, type, and model (all ints) and sort by year, then divide the array in all the objects with the same year and sort them by type, then divide the array again into the objects with the same year AND type and sort them by model.
    the object a Dress objects, the get methods are get+nameof parameter.
    the array is a 1D array called Dresses.
    I have made a paralell array to store the value of the parameters and sort that then move the array acording to that sorted array. The problem is in the division of the array.

    We'll give your request to do (or finish) your homework for you the attention it deserves.

  • Converting an array to a list using javascript

    There are several methods that return arrays, which we all know express cannot handle. The IDM faq metions you can use a script tag to manipulate array data, but gives no example. I like this method because some methods I encounter preface the object name with the object type, and the data needs to be cleaned before use. I always like little snippits that can be reused, so I'm sharing this one.
    Here is how to convert an array to a list, assuming the array is captured in "stupidarray":
        <split>
          <script>
            var myarray = env.get('stupidarray');
            // Code to manipulate the array
            outputarray = myarray.join(",")
            // Other code to manipulate the string before output
            // i.e. Stripping out the object type tags!
            // outputarray.replace(/User:/g,"");
          </script>
          <s>,</s>
        </split>

    there is a waveset util class provided for this, please check API
    --sFred                                                                                                                                                                                       

  • Fill method isn't working on arrays.

    I am trying to use(on JDK 1.4) the fill method of util.Arrays class to fill an array. It gives "cannot resolve symbol" error at the line with fill command. What am I doing wrong here ?
    import java.util.Arrays;
    public class arrtest {
    public static void main(String[] args)
    int arr[] = new int[20];
    fill(arr,0,7,1);
    }}

    The fill() method is a static member of the Arrays
    class and hence must be identified as such. Try
    substituting the following line for what you already
    have:
    Arrays.fill(arr, 0, 7, 1);ShaunYup.
    Thanks Shaun.

Maybe you are looking for

  • Adobe Reader won't open automatically when clicking on online form link

    I created a form in LiveCycle Designer, reader-enabled it, and then it was uploaded to a university website for students to access to apply for graduation from an advanced degree program. However, when students click the link, the dreaded "Please wai

  • List View webpart from subsite to Top site shows random error "List Does not exist"

    Hi All, We have a list in subsite and we are creating a view for that list which we are showing in one of the top site home page. We have taken care of changing the web and list guid of list view webpart when we added on top site. Its working fine bu

  • Poor Performance of Safari with YouTube

    Recently I have noticed really poor performance of Safari when I try to watch videoes on YouTube. I have experienced this both with my 2009 iMac desktop and my brand new MacBook Pro w/ Retina Display. This can't be a network problem because I pay Ver

  • Return in excise

    Hi, scenario is: i have sold 10 nos  excisable finished product from excisable plant to our customer.(OR-LF-F2-J1IIN) Relevent registar RG1 updated ,extraction done. After two months , customer returns 2nos back to plant.Return OR-Return LF- after th

  • Iphone 5 on vodafone

    has anyone got signal problems with iphone 5 on vodafone uk