Add elelment by element in an array of cluster

Hi All,
I have a problem in extracting data from array of cluster to a single cluster. Please have a look at the attachment.I have found the solution but it consumes lot of memory because of shif registers andi am using this many places which is loading to nearly 100% in RT. Please provide an better alternative solution.
Attachments:
Array of Clusters.JPG ‏153 KB

AutoTEC wrote:
Hi,
No i am almost at the end of coding . If i change the entire architecture affects. Only problem is this logic consumes more time. Pls any other idea...
Standard situation if a propper data management is not done before coding OR  lead to the wrong architekture.
Do you use type definitions? Help a lot to avoid the horror of optimizing the datastructure.
Since it is much faster to rebuild a cluster by indexing the elements from your cluster of arrays than generating a cluster  of arrays from an array of cluster (Puh!) 
AND you have timing problems I see only two solutions : Faster hardware or a reorganisation of your data.
So change the datasturcture , create a subvi 'IndexMyData2Cluster' and whereever you indexed the array of cluster  replace it with that vi.
Or run both structures in parrallel (BRRR, race conditions, inconsistent data , uuuaaahhh)
Greetings from Germany
Henrik
LV since v3.1
“ground” is a convenient fantasy
'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'

Similar Messages

  • Adding an element in an array of cluster of 2 elements

    Hi all,
    I have a 1D array containing a cluster of 2 numeric elements (= 2 rows of 100 values).
    From this array, collecting new data in for loop, I want to create another array containing a cluster with 9 elements: in each for I want to add an element (= like one row).
    After this, I want to compare data from one element with a fixed value, and when the value is find in the element, I want to extract the values of the 8 other elements at this point.
    Thanks
    Dze

    Sorry I didn't understand you well. To use only arrays, you'll need 3D arrays, as you can see in the example attached. I've made two variants, one with your method (don't know if there's an easyer one) and one with the method I think is easyer, after that, you can search in the 3D array easyer that in the array of clusters of arrays (uff...). If I misanderstood you again, please let me know.
    Hope this helps
    Attachments:
    arrayclusterarray.llb ‏50 KB

  • Add element to array of cluster

    I have an array of cluster. Cluster contains two elements. How to add an element in cluster at run time on the second position efficiently? In other words dont want another copy of cluster which contains three elements and copy the original two elements plus the new element. 
    Original array of cluster lets say has two element Temp1 and Pressure 1.
    Need to add another element in cluster and now the array of cluster will be Temp1, Volt1 and Pressure 1. So Volt 1 is added to all cluster elements at second order throughout the array of clusters programatically. 
    CLD,CTD
    Attachments:
    TestAddElementToCluster.vi ‏10 KB

    It is unclear from your original post what the problem you need to solve actually is.  Are you trying to create a user interface?  Do you need to dynamically add arbitrary data to a data set, or is it a fixed set of functionality that can be dynamically changed in predetermined ways?
    Having done it, I will recommend you not try the scripting and subpanels approach.  There are almost always better ways.
    Remember that your data structures do not need to mirror your user interface.  If you were trying to display the temperature, voltage, and pressure data to the user, a multicolumn listbox may be more appropriate than a raw cluster in an array.  Internally, this would allow you to maintain the temperature, voltage, and pressure as separate arrays and only display the ones you want in the listbox.
    Please give us a more information on the problem so we can help you with an easier solution.
    This account is no longer active. Contact ShadesOfGray for current posts and information.

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

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

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

  • Can;t find what is wrong. Trying to add elements in two arrays

    Hello everyone
    I'm trying to take as input two numbers, convert them to arrays and add all the element of the array one by one. I want the result to be the sum of every element of the array. Let's say array1={1,2,3,4} and array2={2,6,4,3} I want the final result to be 3877.
    If the sum of one element of the array is greater than nine, then I would put zero and add 1 to the element on the left.
    Here is the code:
    import javax.swing.JOptionPane;
    public class Main {
        public static void main(String[] args) {
            String numberOne = JOptionPane.showInputDialog
                                    ("Enter the first number: ");
         String numberTwo = JOptionPane.showInputDialog
                                    ("Enter the second number: ");
            //compare string length and make them equal length
            int[]n1 = toArray(numberOne); // my first array
         int[]n2 = toArray(numberTwo); // my second array
         //call the method that ads both strings
         int[]finalArray = arrSum(n1,n2);
           JOptionPane.showMessageDialog(null, "The sum of the two numbers is: "
                   + finalArray);
        }//end of main
        //method to create an array from a string
        public static int[] toArray(String str)
                int[]arr = new int[str.length()];
                arr[0]=0;
                for (int i=1; i<str.length(); i++)
              arr= Character.digit(str.charAt(i),10);
    return arr;
    }//end of toArray
    //method to add arrays by elements
    public static int[]arrSum (int[]arr1, int[]arr2){
    for (int i = arr1.length-1; i >=1; i--)
    int sum = arr1[i] + arr2[i];
    if (sum > 9)
              { sum -= 10;
              arr1[i-1]++;
    return arr1;
    }//end of arrSum method
    }Edited by: designbc01 on Feb 16, 2010 1:15 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    The best advice I can give you is to break your problem up into smaller pieces. First, focus on a method that converts an input String into an array. When you have that working perfectly, then focus on creating a method that "adds" two arrays with the logic you described. When you have that working perfectly, then combine the two different pieces.
    Why does your for loop in toArray( ) start with 1? The first index of a String, array, or pretty much anything else, is zero.

  • Boolean LED Blinking in Array of Cluster

    Hello,
    I did not found anything to my problem in the developer zone of ni.com. Only how to index a element in an array of cluster.
    I want to set the Property "Blinking" of a boolean LED control in an array of cluster. But all attemps were to no avail and nothing happens.
    Can someone look at my VI please?
    Thanks shavo
    Message Edited by shavo on 05-28-2009 05:12 AM
    Attachments:
    ClusterBlinking.vi ‏58 KB

    It's not possible to change the physical property of the element of a array of cluster.
    Balaji PK (CLA)
    Ever tried. Ever failed. No matter. Try again. Fail again. Fail better
    Don't forget Kudos for Good Answers, and Mark a solution if your problem is solved.

  • Javascript array ;Add and remove elements without using push and pop

    Hi
     I need to perform add and remove  operation in Javascript with following scenarios
    i) Add element, if element does not exist in array(javascript)
    ii) Remove element, if element exist in array(javascript)
    Without using push and pop method how to achieve this?
    Regards
    Siva

    Completed the Scenario.

  • Failed to compare two elements in the array

    very often, I have the error "Failed to compare two elements in the array" in Exchange 2013 ECP. We are not running DAG. I google a bit but don't get a lot of result on this.
    I was trying to track mail from a user who send to DL group. Since I can't do in in ECP , how can I do it in EMS?

    I too have this issue.  I'm not sure how wide spread.  I know of one user who sends emails regularly to a DL named "All Users" which is a Security Group which we then add real users to and not just every mailbox.  When he sends the emails,
    from his perspective, everything is fine, meaning he gets to NDR or anything.  Also, when he adds the Dl in Outlook To field and expands it, all the correct users are there.  In fact, it tells him there are 203 addresses here.  However, only
    184 are actually getting the message.  When I try the EAC to view the tracking report, it will show the message, but if I click on the edit button, I get "Failed to compare two elements in the array".  If I try from EMC with search-messagetrackingreport
    -identity "recipient address" -sender "sender address" -bypassdelegatechecking and the recipient address is the group, it says it could not be found.  If I try with simply putting an email address of someone who is a member of that group, it says Warning:
    An unexpected error has occured and a Watson dump is being generated.  Failed to compare two elements in the array.  I don't know what else to try.  Anybody??

  • Sort an an arrayList by the first element of an array

    Hi,
    I am really struggling trying to sort an arratList of arrays. I have an arrayList
    ArrayList<String[]> myArrayList = new ArrayList<String []>(100);
    Within this array I have may arrays with 2 elements
    String[] myArray1 = {"Peter", "London"};
    String[] myArray2 = {"John", "London"};
    String[] myArray3 = {"Tony", "Birmingham"};
    I add all these arrays to the arrayList and want to sort by the first element of the array. Basically I expect the final arrayList to be in the order of:
    "John", "London"
    "Peter", "London"
    "Tony", "London"
    Thanks
    Peter

    Hi,
    I am really struggling trying to sort an arratList of
    arrays. I have an arrayList
    ArrayList<String[]> myArrayList = new
    ArrayList<String []>(100);
    Within this array I have may arrays with 2 elements
    String[] myArray1 = {"Peter", "London"};
    String[] myArray2 = {"John", "London"};
    String[] myArray3 = {"Tony", "Birmingham"};
    I add all these arrays to the arrayList and want to
    sort by the first element of the array. Basically I
    expect the final arrayList to be in the order of:
    "John", "London"
    "Peter", "London"
    "Tony", "London"
    Thanks
    PeterThis can be done by using
    Collections.sort(myArrayList, new Comparator<String[]>() {
    public int compare(String[] s1, String[] s2) {
    if (s1.length() <1) {
    return -1;
    if (s2.length() <1) {
    return 1;
    return s1[0].compareTo(s2[0]);
    });

  • Change properties of a cluster element withing an array of clusters

    Hello all,
    I have an array of cluster that is shaped as a line with different display elements.
    A list or a tree wouldn't have made it, so I had to use a cluster and make a table.
    The problem is that I want to change not only the text but also the text color.
    Individually.
    I found this :
    http://www.ni.com/example/30904/en/
    But it change the property in all the clusters in the array, not just the one I need.
    Some people have the same problem :
    http://forums.ni.com/t5/LabVIEW/Reference-to-Array-of-Clusters-with-an-array-element/td-p/1006427
    http://forums.ni.com/t5/LabVIEW/Different-set-of-values-for-two-rings-in-an-array-of-clusters/m-p/10...
    http://forums.ni.com/t5/LabVIEW/array-of-clusters-get-references-to-all-the-clusters/td-p/1079456
    http://forums.ni.com/t5/LabVIEW/How-can-I-reference-the-properties-of-a-control-in-a-cluster-in/m-p/...
    http://forums.ni.com/t5/LabVIEW/Writing-only-to-certain-cluster-elements-in-an-array-by/m-p/2200728
    http://forums.ni.com/t5/LabVIEW/Update-Properties-Of-One-Control-In-An-Array/m-p/3015501
    http://forums.ni.com/t5/LabVIEW/Array-of-clusters-and-in-the-cluster-is-a-bar-meter-how-can-I/m-p/15...
    http://forums.ni.com/t5/LabVIEW/Property-node-of-a-control-inside-of-cluster-inside-an-array/m-p/946...
    Obviously, while in a list/table or tree you can change the property of an individual
    cell (font, color) you cannot do it within an array of cluster, by some sort of magic,
    the property of a cluster element (font, color) are all linked together, hence rendering
    the use of an array worthless.
    A possible hack is proprosed by using control masking, setting one visible and the
    other invisble, swapping their position, whatever. It's a hack you have to perform,
    hence add another code to maintain.
    Is that still the case or is there now a more official way to handle individual cluster
    properties, not just its data ? After all that's a common real-life example that should
    be handled by Labview. In my opinion.
    David Koch
    Solved!
    Go to Solution.

    altenbach wrote:
    One of the elements could be a 2D picture indicator of about the same size. You can write text in any color using picture functions.
    Here's what I had in mind. Seems to work just fine (I would fine-tune the font, picture border, etc. but this should get you started).
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    ColorText.png ‏13 KB
    ColorText.vi ‏9 KB

  • Summing specified elements in 2D array.

    Hi!
    I have a little problem with summing elements in 2D array… I have signal from 64 sources in the 2D array - 64 colums and (time*sampling) rows. I have to add some deley to every signal (different for each)  and then sum signals from all of the sources. I hope the picture below explains what I have to do:
    What's more - I have a 2D array of delays. By now I'm doing this by creating an 1D array of "0" and then putting in it the 1D signal array at index specified by delay value.
    And it works ok. But... It takes long time... Is there any method to do the summing "at once" for all the delays? Is there sth like "pointer" in array, so I could take elements from the array from specified element?
    Rgds,
    Mordimer 

    One problem with your solution is also that the subset is of variable lenght due to truncation, so the shift register needs to be reallocated whenever the size changes. (Even if you define a lenght for the subset, you run out of elements and the result will be shorter!). You might want to e.g. truncate all to the shortest subset (longest delay) before summing for better inplaceness.
    Why do you have a 2D array of delays? isn't the time spacing of each column constant?
    What is your definition of "takes a long time": microseconds?, minutes?
    Message Edited by altenbach on 12-03-2009 03:20 PM
    LabVIEW Champion . Do more with less code and in less time .

  • How to create an array in one field and have another field display certain elements from that array?

    I am making a form in Acrobat XI pro.
    In one text field, I created an array of several elements. I want other text fields to display certain elements from that array. For instance, one field should display the 3rd element, another field should display the 13th element, etc.
    The Javascript for making the array is very long, and so I don't want to have to re-calculate the array every single time (in order to reduce rendering time when I open the form on an iPad). This is why I'd like to only have to create the array once, and simply refer to it throughout the form.

    What code are you using to update the array currently? Are you completely rebuiding it when an element changes, or just changing specific elements for certain fields? I'm still not sure what exactly you are trying to do, but something like this in a document level script will create your array:
    var myArray;
    // Call 'updateArray' to initialize array
    updateArray();
    function updateArray() {
         // Code here to create/update array
         myArray = new Array();
         myArray[0] = "Value 1";
         myArray[1] = "Value 2";
         myArray[2] = "Value 3";
    Then, for each field that needs to update this array, you can add a call to 'updateArray()' in the appropriate event. This will rebuild the array completely; if you just want to update specific elements, then you can access them directly.

  • The order of elements in an array.

    Hi
    I have an array whose array.length is 3.
    I need to add a new element at the the first position in the array.
    For example the existing values in the array are
    1,2,3.
    Now I need to add 10 in the first position so that the array looks like : 10,1,2,3.
    Is there any Java API that accomplishes this.
    Any help is highly appreciated.
    Thanks in advance.

    You can use the new appendToBeginning method of the CrazyMadeUp Class. It's available in version 1.6 (codename Monkey) and above. Unfortunately it only works with Objects though.
    public static Object[] appendToBeginning(Object[] originalArray, Object[] addToStart) {
      Object[] tempArray = new Object[originalArray.length + addToStart.length];
      System.arraycopy(originalArray, 0, tempArray, addToStart.length, originalArray.length);
      for (int i = 0; i < addToStart.length; i++) tempArray[i] = addToStart;
    return tempArray;

  • Updating elements in my array

    Hello
    Im very new to Labview and this may seem like a trivial problem to some. But it is driving me crazy. I have an array that i want to display as a table. I want to be able to input into this table and be able to add rows or delete rows as i please. The problem is that if I enter a number in an element of the array and i add a row it blanks out whatever I had written. Attached is my code. I think there should be a simple solution to this coz i havent been able to find much online help to it.
    Attachments:
    test-1.vi ‏208 KB

    The changes of the array values are not recorded in the shift register. You have to catch another event : the array value change, and pass the new array value to the right shift register.
    CC
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        

  • Adding next element into an array

    I can manage to add the first element as I want in a for loop, however, the next element simple overwrites the index array element. I would like it to add the next element to the next space in the array.
    This is how I have declared it.
    private String stuff[];
    This is it initialised, with 10 as an example.
    Stuff = new String[10];
    This is inside a method with a string tokenizer ("st").
    while(st.hasMoreTokens())
    boolean comparsion = enter.equals(st.nextToken());
    if(comparison == true)
    stuff(i) = st.nextToken(); <<the brackets next to stuff () are meant to be [] but forum formats to italic
    I am trying to add values that match what is entered in a parameter (enter is the parameter variable) against the tokens in a file. It seems to add the first match in the array and then if run again it replaces this a new match and is not added as the second element. Any help much appreciated.
    Thanks.

    Use the code tags as follows next time:
    your codeThank you.
    Your problem is you do not increment i;
    stuff = new String[10];
    int i = 0; // declare and initialize i
    while (st.hasMoreTokens())
      boolean comparsion = enter.equals(st.nextToken());
      if (comparison) // no need to == true
        stuff[i] = st.nextToken();
        i++:  // increment i
    }

Maybe you are looking for