Dynamic array to cluster

During runtime my main VI is loading a data file that is dynamic in size and content (created by another VI). It is loaded as a 1D array. I am looking to convert this array into a cluster of elements and display the titles and values of each element. I'm pretty sure I can figure out the labeling but I can't get the conversion to work dynamically... Can anyone help??
Scott@P&E

If your problem is to associate a name/label to each numerical value from the 1D array, you should consider using a 2D string array. The first column could contain the names and the second column the values. A Table control could do the trick very nicely.
CC
Chilly Charly    (aka CC)
         E-List Master - Kudos glutton - Press the yellow button on the left...        

Similar Messages

  • Dynamic array to cluster creation

    Hello,
    Is there a way that labview recognises the array size and automatically unbundle it into that many clusters as number of elements in the array?
    PS. I am using labview 8.2 
    Labview 8.2
    Learner
    Solved!
    Go to Solution.

    That would simply force you to use a default cluster of 9 elements. What if the array is more than 9?
    @ravi:
    You do not need to convert an array to a cluster and then unbundle the cluster to get the individual elements. Index Array is resizable. Better yet: use a for-loop with autoindexing. As to the actual graph that's being created I don't quite understand it. You are using the same X value with different Y values. That's just a vertical line. As altenbach likes to say, your code can be simplified to fit on a small stamp:
    Message Edited by smercurio_fc on 05-01-2009 09:25 AM
    Attachments:
    Example_VI_BD.png ‏6 KB

  • Connect 1 D array of cluster of 2 elements with dynamic data

    Hello
    The type of source is 1D array of cluster of 2 elements and the type of sink is dyanamic data. Can any one guide me how to connect these 2 elements together. Any response would be highly appreciated. 
    Thanks 

    First, this question would more appropriately be posted to the LabVIEW Board. It is not a signal conditioning issue.
    The dynamic data type (DDT), sometimes referred to as the "evil dynamic data type," completely obscures the internal data structure. The only way someone could help is if you tell us what the source is expecting the internal data structure to be. The only objects which want DDT inputs are Express VIs, which are also good at obscuring thier contents. Implementing the sampe funcitonality with standard VIs might be a better approach.
    You also have not completely specified the source. What are the data types of the cluster elements? 
    Lynn

  • 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.

  • 1D Array of Cluster of 2 Elements Write to Spreadshee​t

    Hi all, first time using LabView in many years.  I am trying to write a VI that will acquire data from our cDAQ (right now just trying to get it to work with a single thermocouple in a NI 9211, but eventually will be 8 X thermocouple, 4 X pressure transducer), display it in realtime on a plot, and then when the acquisition is stopped, output the data to a file for later use.  I am currently using the Base LabView package.
    My problem (as I remember it was 7 years ago when I last used this) is with the data types not working together.  This is my thought process currently on building this VI.  Everything is inside a While Loop with the Wait function at 1000ms.
    - Acquire a point of data using the DAQ assistant
    - Send that point of data into a bundle
    - Send the iteration count into the same bundle (as a timestamp)
    - Send the resulting cluster of 2 elements into a Build Array function
    - Send the resulting 1D array to a shift register in the While Loop, as well as to an XY graph for realtime plotting
    - Wire the incoming point on the shift register back into the Build Array function
    In my mind, this allows the XY graph to plot the complete array every iteration, giving a realtime view of the signal.  Everything works fine up to this point.  My problems are:
    When I stop and restart the program, the shift register is not cleared, so the existing data in the array remains on the graph.  I know I need to initialize the shift register to clear it, but I cannot figure out what to wire to it that will be compatible with the data type (I just get broken wires with everything I tried).
    Similarly, I cannot figure out how to output this data to a spreadsheet after I Stop the While Loop.  I think I should wire the "Write to Spreadsheet File" VI to the outgoing shift register, but again, I can't get compatibility with data types (source is a 1D array of cluster of 2 elements).
    I have attached my current program "Production" to this post.
    I look forward to the help!
    Brad
    Attachments:
    Production.vi ‏46 KB

    Hi Brad,
    I would suggest you change your architecture. First, to answer your questions:
    1.
    In order to ensure that your shift register is not reading the last
    value from it's memory location, you just need to create a constant for
    the shift register. To do this, right-click at the input of the
    'left-placed' shift register and create a constant.
    2. The Write
    to Spreadsheet is expecting a 1-d or 2-d array while you are wiring a
    Dynamic Data Type. Use the Convert from Dynamic Data Type to convert
    the data into the appropriate waveform after which you can get the
    waveform attributes which includes the values and the timestamp data. Or, you can use the Write to Measurement File to write to a .lvm file which can be opened in Excel as well.
    Changes to your architecture:
    Since
    you are using a lot of channels, I would advise you use a
    producer/consumer architecture. You can have a look at this
    architecture by navigating to File -> New.. and searching for the
    Producer/Consumer template. You will notice that this architecture uses
    queues. The way you will design your VI is to use DAQ to acquire the
    data into your producer loop, convert this data into a waveform and
    then send this data to the consumer loop via queues. In your consumer
    loop, you can write this data to a file. At this point, I would
    encourage you to write to a binary file instead of a spreadsheet file. The write will happen faster and you will be using less space on your hard disk when compared to ASCII writes.
    I know this can be real confusing for a beginner, so be sure to post back if you have any questions.
    Adnan Zafar
    Certified LabVIEW Architect
    Coleman Technologies

  • Array to cluster with adjustable cluster size

    Hi all
    Here I have  a dynamic 1D array and I need to convert it into cluster. So I use Array to Cluster function. But I notice that the cluster size is a fix value. How can I adjust the cluster size according to the 1D array size?
    Anyone pls give advise..
    Thanks....

    I won't disagree with any of the previous posters, but would point out a conversion technique I just recently tried and found to work well for my own particular purposes.  I've given the method a pretty good workout and not found any obvious flaws yet, but can't 100% guarantee the behavior in all settings.
    Anyhow, I've got a fairly good sized project that includes quite a few similar but distinct clusters of booleans.  Each has been turned into a typedef, complete with logical names for each cluster element.  For some of the data processing I do, I need to iterate over each boolean element in a cluster, do some evaluations, and generate an output boolean cluster.  I first structured the code to use the "Cluster to Array" primitive, then auto-index over the resulting array of booleans, perform the evaluations and auto-index an output array-of-booleans, then finally convert back using the "Array to Cluster" primitive.  I, too, was kinda bothered by having to hardcode cluster sizes in there...
    I found I could instead use the "Typecast" primitive to convert the output array back to my cluster.  I simply fed the input cluster into the middle terminal to defin! the datatype.  Then the output cluster is automatically the right size and right datatype.
    This still is NOT an adjustable cluster size, but it had the following benefits:
    1. If the size of my typedef'ed cluster changes during development by adding or removing boolean elements, none of the code breaks!  I don't have to go searching through my code for all the "Array to Cluster" primitives, identifying the ones I need to inspect, and then manually changing the cluster size on them one at a time!
    2. Some of my processing functions were quite similar to one another.  This method allowed me to largely reuse code.  I merely had to replace the input and output clusters with the appropriate new typedef.  Again, no hardcoded cluster sizes hidden in "Array to Cluster" primitives, and no broken code.
    Dunno if your situation is similar, but it gave me something similar to auto-sizing at programming time.  (You should test the behavior when you feed arrays of the wrong size into the "Typecast" primitive.  It worked for my app's needs, but you should make sure it's right for yours.)
    -Kevin P.

  • How do I convert a 1-D array of cluster of 5 elements into a 2-D array of numbers? (history data from a chart)

    Hello,
    in my vi I have a chart with 5 Plots displaying measurement data.
    The user should be able to save all the history data from the chart at anytime. (e.g. the user watches the chart and some event happens, then he presses a "save"-button)
    I know, that I can read out the history data with a property node. That is not the problem. The problem is, how do I handle the data? The type of the history data is a 1-D array of cluster of 5 elements.
    I have to convert that data somehow into a 2 D-array of numbers or strings, so that I can easily save it in a text-file.
    How do I convert a 1-D array of cluster of 5 elements into a 2-D array of numbers?
    I use LabVIEW 7.1
    Johannes
    Greetings Johannes
    Using LabVIEW 7.1 and 2009 recently
    Solved!
    Go to Solution.

    Gerd,
    thank you for the quick response and the easy solution.
    Look what I did in the meantime. I solved the problem too, but muuuch more complicate :-)
    And I have converted the numbers to strings, so that I can easily write them into a spreasheet file.
    Johannes
    Message Edited by johanneshoer on 04-28-2009 10:39 AM
    Greetings Johannes
    Using LabVIEW 7.1 and 2009 recently
    Attachments:
    SaveChartHistory.JPG ‏57 KB
    SaveChartHistory.JPG ‏57 KB

  • Populating a dynamic array with objects and managing it in runtime.

    So I'm another stuck firstyear. I'll try and make my question compact. I'm using Flash CS6 and have drawn an animated character on the stage that consists of separate parts that are animated and its head is a separate class/symbol entirely because it has not only animation, but a state switch timeline as well. This said Head extends the Main that is the character MovieClip.
    I am using a dynamic array to store and .push and .splice objects of another class that would collide with this said Head.
    I also discovered the super() function that is implicitly called as the constructor of the parent in any child class that extends the parent, in this case Head extends Main. The issue is that my collidable object array is populated within the main, within the function that spawns every next collidable object with a TimerEvent. This said function then gets called twice due to the super() call.
    I have tried putting this super() call into an impossible statement in my child class, but it doesn't change a thing, and it was said that this method is unsafe so I don't even know if it should be working.
    However what confuses me the most is when I trace() the .length of my collidable object array at the end of that function. As I said earlier, the original function both spawns an object after a period of Timer(1000) and adds it to the stage as well as adds the object onto the object array, but the super() constructor only duplicates the length call and a creates a copy of the object on the stage, but it does not add the second copy of the object onto the array. The trace() output goes on like so:
    1
    1
    2
    2
    3
    3
    4
    4
    etc.
    I wonder why and I'm really stumped by this.
    Here is the code in question:
    public class Main extends MovieClip {
                        public var nicesnowflake: fallingsnow;
                        var nicesnowflakespawntimer: Timer = new Timer(1000);
                        public var nicesnowflakearray: Array = new Array();
                        public function Main() {
                                  nicesnowflakespawntimer.addEventListener(TimerEvent.TIMER, nicesnowflakespawn);
                                  nicesnowflakespawntimer.start();
                        public function nicesnowflakespawn(event:TimerEvent) : void {
                                  nicesnowflake = new fallingsnow;
                                  nicesnowflake.x = Math.random()* stage.stageWidth;
                                  nicesnowflake.y = - stage.stageHeight + 100;
                                  nicesnowflakearray.push(nicesnowflake);
                                  stage.addChild(nicesnowflake);
                                  trace(nicesnowflakearray.length);
                                  for (var i:Number = 0; i < nicesnowflakearray.length; i++){
                                            nicesnowflakearray[i].addEventListener(Event.ENTER_FRAME, snowhit);
                        public function snowhit(event:Event) : void {
                                  if (nicesnowflakearray[0].y >= 460){
                                            if (nicesnowflakearray[0].y == stage.stageHeight) {
                                            nicesnowflakearray.splice(nicesnowflakearray.indexOf(nicesnowflake), 1);
                                  //if (this.hitTestObject(nicesnowflake)){
                                            //trace("hit");
    I am also fiddling with the collision, but I believe that it would sort itself out when I deal with the array pop and depop properly. However I'm pasting it anyway in case the issue is subtly hidden somewhere I'm not looking for it. And here is the child class:
    public class Head extends Main {
                        public function Head(){
                                  if (false){
                                            super();
                                  this.stop();
    So like what happens at the moment is that the array gets populated by the first object that spawns, but there is two objects on the stage, then when the objects reach stage.460y mark the array splices() the one object away and displays an error:
    "#1010: A term is undefined and has no properties.
              at Main/snowhit()"
    then when the next object spawns, it repeats the process. Why does it trace the array.length as "1, 1, 2, 2, 3, 3, 4, 4, 5, 5, etc" until the despawn point and then goes on to display an error and then starts from 1 again, because if the array length is more than one object at the time when the first object of the array gets spliced away, shouldn't it go on as usual, since there are other objects in the array?
    Thank you very much to whomever will read this through.

    There are multiple problems:
    1. You should add eventlisteners for your objects only once, but you add eventlisteners every time your timer runs to all of your snowflakes, again and again:
                                  for (var i:Number = 0; i < nicesnowflakearray.length; i++){
                                            nicesnowflakearray[i].addEventListener(Event.ENTER_FRAME, snowhit);
    change it to
    nicesnowflake.addEventListener(Event.ENTER_FRAME, snowhit);
    I don`t see why its even necessary to employ this snowflakearray, it would be much straight forward if you simply let the snowflakes take care of themselves.
    2. Then you have to change your enterframe function accordingly
    public function snowhit(event:Event) : void {
                                  if (e.currentTarget.y >= 460){
                                            if (e.currentTarget.y == stage.stageHeight) {
                                            e.currentTarget.removeEventlistener(Event.ENTER_FRAME, snowhit);
                                            removeChild(e.currentTarget);
    3.
                                  //if (this.hitTestObject(nicesnowflake)){
                                            //trace("hit");
    since "this" is a reference to the Main class (root) it surely won`t function as you intend it to.
                                  if (false){
                                            super();
    makes no sense to use a condition that can never be true

  • Array of cluster

    Hello,
    i'm using array of cluster to allow user entering differents setting
    But in some case i would like to adapt viewing to hide  some parameters or displaying 0 or a null field
    my problem is when creating a ref on control in the list how to know wich line is concerned to modify the good one
    here a vi for example
    when case 1 is seleced in first column other ctl can be any of  choices
    when case 2 is selected i would like the mofify two others to be 0 and none
    is there an other way than playing with coordonate and size of elements to know which line is the current one ?
    Regards
    Tinnitus
    CLAD / Labview 2011, Win Xp
    Mission d'une semaine- à plusieurs mois laissez moi un MP...
    RP et Midi-pyrénées .Km+++ si possibilité de télétravail
    Kudos always accepted / Les petits clicks jaunes sont toujours appréciés
    Don't forget to valid a good answer / pensez à valider une réponse correcte
    Solved!
    Go to Solution.
    Attachments:
    list of ctl.vi ‏8 KB

    I was able to simplify that VI to the point where I can post the code to demonstrate the idea.  Here it is in both 8.6 and 9 (it seems to have lost some font formatting when saving back to 8.6).  I haven't used XControls at all but it seems like the sort of thing that could be converted to one easily if I had the time and need for it.
    Attachments:
    Array of Clusters in Table.vi ‏52 KB
    Array of Clusters in Table 8.6.vi ‏33 KB

  • Array of Cluster with event structure

    Hi,
    I am having Array of cluster with cluster having 1 String Control , 1 Combo box, 1 Led control and 2 Numeric control. In the combo box i am having two options to select ('Binary' and 'PWM').Whenever Binary is selected then Led control has be enabled and whenever PWM is selected 2 Numeric control has to be enabled.
    Is there any way to do this??
    Pleas help me...
    Regards
    Meenatchi

    actually in my application, the front panel has to have 16 rows of controls (1 string control, 1 combo box, 1 Led control, 2 numeric control).so i planned to keep all those controls in a cluster and create one array.If i didnt so i will have 16x5 controls in my front panel and i have to put 16 event cases for each combo box to do the enable and disable of controls..
    is there any simple way to do this..i have attached my front panel view
    Attachments:
    Untitled10.vi ‏139 KB

  • Array to Cluster, Automate cluster size?

    I often use the Array to Cluster VI to quickly change an array of data into a cluster of data that I can then connect to a Waveform Chart.  Sometimes the number of plots can be different which results in extra plots (full of zeros) on the graph, or missing plots if the array is larger than the current cluster size.  I know I can right-click on the node and set the cluster size (up to 256) manually.  I could also use a case structure with as many Array to Cluster nodes as I need, set them individually and wire an Array Size to the case structure selector but that's kind of a PITA. 
    My question is whether or not anyone knows a way to control the cluster size value programatically.  It seems that if I can right-click it and do it manually there must be some way to automate it but I sure can't figure it out.  It would be nice if you could simply wire your desired value right into an optional input on the node itself.  Any ideas will be much appreciated.
    Using LabVIEW: 7.1.1, 8.5.1 & 2013
    Solved!
    Go to Solution.

    I'm under the impression it's impossible.  See this idea for related discussion.
    Tim Elsey
    LabVIEW 2010, 2012
    Certified LabVIEW Architect

  • Dynamic array

    how to implement dynamic array size in java...??
    say if i want to add the element in an array then how should i do it..??

    For dynamic array...Vector is the best one i
    est one i think....
    Sigh. Unless other code requires it (for example, JTable's DefaultTableModel),
    Arraylist is preferred over the legacy class Vector.
    And even then I wouldn't recommend ArrayList as the "best" list. What if the OP
    wanted to have a FIFO queue? Would you recommend ArrayList/Vector over
    LinkedList?

  • 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 ǝɥʇ'

  • Programmatically Change Array to Cluster Size

    Hello,
    I have a Chart with several values scrolling across it. The number of
    values is variable. To prepare the data for the Chart, I use the Array to
    Cluster element. Is there a way I can programmatically change the size of
    the cluster output?
    Thanks,
    Peter

    Peter,
    As far as I know, you cannot programatically chage the size of the cluster output in the Array to Cluster vi. However, you may not need to convert to a cluster for charting. The chart will take a 2D array and plot mutiple lines. See the attached example which uses Reshape Array to form the data for a chart.
    The only hitch is that it erases the plot when you change the number of values to plot. This may or may not be important to you.
    Tim
    Attachments:
    Reshape_array_for_chart.vi ‏18 KB

  • Creating a dynamic Array

    Thanks for reply.
    I want to create a dynamic array and for this I used ArrayList Collection and Vector Class. I am using JDK 1.4.1 . But , I have a problem in that. In ArrayList, I used the following code:
    ArrayList al = new ArrayList();
    while(rs.next())
    al.add(rs.getString("Enter_Year"));
    al.add(rs.getString("UG_Production_Mi_Te"));
    al.add(rs.getString("OC_Production_Mi_Te"));
    al.add(rs.getString("Total_Production_Mi_Te"));
    al.add(rs.getString("OBR_MM3"));
    al.add(rs.getString("OMS_Te"));
    al.add(rs.getString("Coal_Offtake_Mi_Te"));
    al.add(rs.getString("Supply_to_Steel_Plant_Th_Te"));
    al.add(rs.getString("Royalty_SalesTax_MP_Crs"));
    al.add(rs.getString("Royalty_SalesTax_CG_Crs"));
    al.add(rs.getString("Total_ManPower"));
    al.add(rs.getString("Fatality_Rate_per_Mi_Te_Output"));
    al.add(rs.getString("Total_Wellfare_Expenditure_Crs"));
    String rpt[][] = new String[al.size()][];
    rpt = al.toArray(rpt); // ArrayStoreExecption error
    String colheads[] = {"...........My Table's Column names are here....."};
    JTable table = new JTable(rpt,colheads);
    JScrollPane jsp = new JScrollPane(table);
    add(jsp);
    At the statement having comment line I received the error ArrayStoreException. The JTable accepts the 2 D array for storing the info and I think the toArray() method is not working there and can't convert the ArrayList elements into an Array. Similarily, Vector Class is also not converting the elements into an array object and showing the same error only.
    Please help me to convert it into an array object so that I can pass it into the JTable argument.

    That isn't a jdbc problem but rather a collection problem.
    You certainly can't convert a one dimensional collection into a two dimensional array automatically. And that is what you are creating with the while loop.
    Since you know the column names you also know the inner array size so you can start by creating a statically sized string array (not collection) in the loop and add that to the outer collection. That might solve the problem.

Maybe you are looking for

  • Windows 7 bootcamp problem, my iMac won't download support software

    I am trying to use bootcamp to instal Windows 7 on my iMac desktop, But I keep getting a message saying no support download is availible. What do i do to get bootcamp working?  I need windows for School for my engineering class and C++ classes.  Can

  • File Adapter with Network Drive

    Hi all, I am trying to read a file from Z:\ that is actually pointing to a network drive of another machine. However i am getting the error Configured source directory 'Z:\xxx' does not exist. I am running Windows Server on both machine. I have map t

  • How to check the status of an IDoc in the Target system

    Hi Experts, we are using a self-made program to send Material and BOMs from Client A to Client B into the same ERP System. How can I check the status of an IDoc in the Target Client B (like BD87 - ALE Monitor) ? If you have some examples or Function,

  • How to optimize this RW code? (full version)

    Hello: (Sorry for the wrong previous post, hope the moderator delete it) I have this code: import java.io.*; class Number     private byte val=0;     public void Read(DataInputStream ar) throws Exception {val=ar.readByte();}     public void Read(Rand

  • GOT A SIM CARD BUT WONT ACCEPT TOP UP.

    i GOT A SIM CARD TODAY FOR MY IPHONE BUT WHEN I TRY TO TOP UP ON 450 IT JUST CANCELS THE CALL. I CAN ACCESS WIFI FINE BUT NOT MAKE CALLS. I HAVE GONE THROUGH THE RESTORE PROCESS BUT NO JOY. ANY IDEAS?