Having difficulty cluster convert to array of enumeratorsHi I have difficulty conver

Hi I have difficulty converting a cluster of enumerators to array of enumerators, unlike unbundle and build_array vis that work.
So If I have a unknown number of enumerators, I cannot use unbundle and build_array vis as they are fixed for decided number.
I am using Labview 7.1. I am puzzled over its ability to convert.
so here's the attached.
Would appreciate your help.
thanks in advance
Attachments:
cluster to array of enumerators.vi ‏24 KB

The problem you are having is that your enumerated data elements are not the same.  Enumerated data types include the string value,  So, since you have moved None around in the list and taken away a value from each, LabVIEW doesn't consider the data types to be the same.
I have attached three VIs showing options.
The first uses the same enum type for all the values.  The issue here
is that the value of None doesn't change.  But, you can also convert
this into your array of enums instead of U16s.  Please note that if you
went this route, you should probably use a type def so if you ever had
to add an 8, you'd do it once.  Not knowing your ultimate goal, it is
difficult to suggest a method, although I would use the last example.
In the second, I changed your enums to rings.  The rings don't care what the string values are, so you can keep the different pull down lists as you had them in your original.
The third uses the different enums you have and uses a typecast to a U16 array.
The second and third examples lose its data meaning because you basically need to know how the values track back to the original data type.  The first keeps the data type.  But again, it may be beneficial in your case to have the values change based on which value is set ot None.
Matthew
Message Edited by Matthew Kelton on 09-02-2007 10:49 PM
Attachments:
cluster to array of enumerators.vi ‏14 KB
cluster to array of enumerators (ring).vi ‏12 KB
cluster to array of enumerators (typecast).vi ‏12 KB

Similar Messages

  • Need a little help trying to convert an array into a cluster..

    I'm having a difficulty converting the output of the AI Acquire Waveforms.vi from an array into a cluster. On my display panel I have a radial termperature gauge with two needles displaying the temperature of two different inputs. The input to this radial guage is of the cluster type, hence the need to convert.
    Any help is appreciated. Heck even if there is a better way let me know.

    The output of "AI Acquire Waveforms.vi" is an array of waveforms (waveform data type). You must first isolate the two elements of that array that correspond with the channels to which your temperature sensing devices are wired. If those are the only channels in your scan list, then the array should only be two elements in size. You can apply a shortcut if that is the case, but first the general solution.
    1) Index the array of waveforms with an Index Array function found in the Array pallette. Stretch the Index Array function so that it gives you two inputs and outputs. Wire the index of the first and second temperature channels to the bottom inputs of the Index Array function. Wire the output of "AI Acquire Waveforms.vi" to the top input of the Ind
    ex Array function. The outputs of the Index Array function are each a waveform for the corresponding channel you selected.
    2) Get the "Y" waveform component for each channel. Use the Get Waveform Components function in the Waveform pallette. It looks alot like an unbundle function. Get two of those guys and wire then to each of your outputs from the Index Array function. Select "Y" for each Waveform component.
    3) Average (or otherwise reduce) the acquired signals. The output of the "Y" component is an array of floats. You can wire that array up to an Average function to give you a scalar value. Do that for each output and now you just have two numbers.
    4) Bundle your numbers. Use the bundle function.
    5) Wire the bundle to your indicator.
    Enjoy,
    Daniel L. Press
    www.primetest.com

  • How can I convert an array with varying length into a cluster

    Hi,
    I need to convert an array of n elements into a cluster. Usually, it only involves the "Array to Cluster" function. But since the array length is not constant and the number of elements in the function is constant and can not be changed programaticaly, I need to find another way to do that.
    Any ideas?
    Thanks.

    Hi,
    I also tried to do this but without success. I think that's not possible.
    For me it's a general problem using labview. I often wanted to generate standard controls dynamically which is not possible (or I haven't found the solution yet). So I think that's the reason why you can't create a cluster during runtime (the program would have to add controls dynamically to the cluster).
    Do you have an upper limit for your array-size? Although it needs a lot more memory, it would be a possibility to create the cluster with the maximum number of elements.
    If you don't have a maximum, you will have to look for another way, I'm afraid.
    Thomas
    Using LV8.0
    Don't be afraid to rate a good answer...

  • How to convert an array collection instance to a complex object for interaction with webservice

    Hi there,
    I have a stubborn problem that I am trying to work out the best way to solve the problem.  I am interacting with a WebService via HTTPService calling a method called find(String name) and this returns me a List of ComplexObjects that contain general string and int params and also lists of other Complex Objects.  Now using the code:
    ArrayCollection newOriginalResultsArray = new ArrayCollection(event.result as Array)
    flex converts my complex objects results to an arraycollection so that I can use it in datagrids etc.  Now up until this part is all good.  My problem is when getting a single instance from the results list, updating it by moving data around in a new datagrid for example - I want to interact with the webservice again to do an create/update.  This is where I am having problems - because these webservice methods require the complex object as a parameter - I am struggling to understand how I can convert the array collection instance back to my complex object without iterating over it and casting it back (maybe this is the only way - but I am hoping not).
    I am hoping that there is a simple solution that I am missing and that there is some smart cookie out there that could provide me with an answer - or at least somewhere to start looking. I guess if I have no other alternative - maybe I need to get the people who built the service to change it to accept an array - and let them do the conversion.
    Any help would be greatly appreciated.
    Bert

    Hi Bert,
    According to my knowledge you can use describeType(Object) method which will return an XML... That XML will contain Properties and values just iterate through the XML and create a new Object..   Probably u can use this method...
    public function getObject(reqObj:Object,obj:Object,instanceName:String,name:String=null,index:int=-1):Obj ect
                if(!reqObj)
                    reqObj = new Object();
                var classInfo:XML = describeType(obj);
                var className:String = instanceName;
                if(name!=null)
                    className=name+"."+className;
                if(index!=-1)
                    className=className+"["+index+"]";
                for each (var v:XML in classInfo..accessor)
                    var attributeName:String=v.@name;
                    var value:* = obj[attributeName]
                    var type:String = v.@type;
                    if(!value)
                        reqObj[className+"."+attributeName] = value; 
                    else if(type == "mx.collections::ArrayCollection")
                        for(var i:int=0;i<value.length;i++)
                            var temp:Object=value.getItemAt(i);
                            getReqObject(reqObj,temp,attributeName,className,i);
                    else if(type == "String" || type == "Number" || type == "int" || type == "Boolean")
                        reqObj[ className+"."+attributeName] = value; 
                    else if (type == "Object")
                        for (var p:String in value)
                            reqObj[ className+"."+attributeName+"."+p] = value[p];
                    else
                        getReqObject(reqObj,value,attributeName,className);
                return reqObj;
    Thanks,
    Pradeep

  • I am having difficulty in printing from my ipad to a Kodak Hero 9.1 WiFi printer. I am using Prin Pro Central as an App. The printer is not recognised on my Ipad. Any help or ideas would be appreciated.

    I am having difficulty in printing from my ipad to a Kodak Hero 9.1 WiFi printer. I am using Prin Pro Central as an App. The printer is not recognised on my Ipad. Any help or ideas would be appreciated.

    Versuche es mal ohne express vi s
    Eine Whileschleife, dessen Zähler Du als Zeitbasis verwendest,
    Sinusfunktionen als Signalquellen, g .....  ups english forum
    Try it without express vis
    a while loop with the index as timebase (multiply by your timestep to get t)
    sinus functions with 2 Pi  t  as signals
    In your vi in every interation of the while loop you generate an array of values where you always pich the same index   ...
     PS: here is my version
    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 ǝɥʇ'

  • Event structure to detect value change of a control within a cluster in an array

    I have 1D array that contains a cluster. The cluster contains a numeric and a boolean control.
    If the user starts to edit the numeric control value i would like to call one subVI, and if the boolean control value is changed, call a different subVI.
    The array control on the front panel allows the user to edit a number of the array elements. 
    I would like to use an event structure to detect a value change in the cluster. When editing the Events, in the Event Sources panel i get the option to select only the array, not the cluster within the array or the controls within the cluster. Can the Event structure be opened up to show controls within clusters and arrays?
    The solution i am using is to detect a mouse up event on the array and then use property nodes to  determine if the key focus is on the numeric, and  a case structure to determine which subVI to call. This works, but is there a better (simpler) way?
    Thanks, Blue.

    Thanks for the responses guys.
    The tricky bit was that i wanted the numeric control values to flag they were going to be edited, so i could call a subVI, before their values were changed by the user. This is done by using the key focus property node, - i need to detect changes on the fly rather than post the event.  Probably didn't make this clear enough in my original post. 
    The array is of variable size depending on if the user decides to insert or delete elements. The user also has the option to click and edit the array without having to do to much scrolling through the array index, as the FP shows several elements at a time. The Event Structure does a good job of automatically determining which element in the array is being edited, and returning those values to the property nodes. Turned out simpler than i thought it might be at one point!
    Cheers, Blue. 
    Message Edited by BlueTwo on 01-15-2009 06:52 AM
    Attachments:
    evstrct1.jpg ‏63 KB

  • Problem converting U8 array to date-time string

    Hi All,
    How can I convert U8 array (time_t data type from C dll) to date time string?
    A dll function that I am calling has a structure of string, integer and time_t as one of the parameters. Instead of passing cluster, I pass an array of U8 of the size that the structure should be. All the members of the strcuture and parsed correctly except the date/time.
    Function Parameter:
    typedef struct {
    Int AlarmState ;
    Int AlarmGrade ;
    TCHAR AlarmMessage [100] ;
    time_t AlarmTimeStamp ;
    } WV_ALARM_INFO ;
    Total size = 4 + 4 + 100 + 4 = 112
    Using Call Library Function, I set the parameter type to Array of U8 and size 112.
    After the array is populated when the function is called, I have done the following to interpret date and time.
    1) Using Extract Zero Terminated String.VI I converted U8 array (of size 4) to string.
    2) Type casted string to integer (I32).
    3) Swap bytes
    4) Swap Words
    5) Format Date/Time String.
    Please see the attached screenshot for visual display of the above.
    Ideas on why the year is incorrect?
    Mimansa
    Attachments:
    Time.JPG ‏102 KB

    Hi Mimansa,
    Is it only the year that is incorrect? Also, where did you find that ABC\0 VI that you use 3 times? Did you make it or is it in a labview library somewhere?
    Thanks,
    Laura

  • Convert an array of strings into a single string

    Hi
    I am having trouble trying to figure out how to convert an array of strings into a single string.
    I am taking serial data via serial read in a loop to improve data transfer.  This means I am taking the data in chunks and these chunks are being dumped into an array.  However I want to combine all elements in the array into a single string (should be easy but I can't seem to make it work).
    In addition to this I would also like to then split the string by the comma separator so if any advice could be given on this it would be much appreciated.
    Many Thanks
    Ashley.

    Well, you don't even need to create the intermediary string array, right? This does exactly the same as CCs attachment:
    Back to your serial code:
    Why don't you built the array at the loop boundary? Same result.
    You could even built the string directly as shown here.
    Message Edited by altenbach on 12-20-2005 09:39 AM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    autoindexing.png ‏5 KB
    concatenate.png ‏5 KB
    StringToU32Array.png ‏3 KB

  • Converting an array to a Linked list.

    I'm writing somewhat of a card game. One of the functions I'm supposed to have is the cut function. I'm supposed to split the deck into two and place the bottom half on top of the top half. My card objects are stored in Nodes in a programmer defined linked list. I believe I successfully converted the linked list into two array (top and bottom) but I am having problems with converting these back to LinkedList (atleast thats where I think my problem is) This is the code i had so far:
         public void cut()
              if (isEmpty())
                   throw new DeckException("Deck of Cards");
              else
                   int pivot = (int)(Math.random()*numCards);
                   Node top[] = new Node[pivot];
                   Node bottom[] = new Node[numCards-pivot];
                   Node traveller = front;
                            //Convert the linkedList into two arrays
                   for(int i = 0; i < numCards; i++)
                        if(i < pivot)
                             top[i] = traveller;
                             traveller = traveller.getNext();
                        else
                             bottom[i-pivot] = traveller;
                             traveller = traveller.getNext();
                            //Convert the two arrays back to a LinkedList, where bottom is put in the front of the list and top is put on the end
                   traveller = front;
                   for(int i = 0; i < numCards; i++)
                        if(i < bottom.length)
                                            //reference comment 1
                             traveller.setNext(bottom);
                             traveller = traveller.getNext();
                        else
    //reference comment 2
                             traveller.setNext(top[i-bottom.length]);
                             traveller = traveller.getNext();
         }I'm not really sure what I'm doing wrong but when i play around with the code I get alot of ArrayOutOfBounds error around the comment above marked as reference comment 1 and 2
    Can someone please give me guidance as to what I'm doing wrong? I feel as If I've reached a block i can't get past.
    EDIT: the variable numCards above should have the value 52
    Edited by: 806583 on Oct 31, 2010 11:12 PM

    My Node class is public. It does not implement the List Interface. This is my Node class:package project3;
    public class Node
      private Card data; //a reference to an object of type T
      private Node next; //the address of the next node in the list
       * default constructor - initializes data and next to null
      public Node()
           data = null;
           next = null;
       * parameterized constructor - initializes data to the user
       * specified value; next is set to null
       * @param newItem the value to be stored in the node
      public Node(Card newItem)
        data = newItem;
        next = null;
       * parameterized constructor - initializes data and next to user
       * specified values
       * @param newItem the object reference to be stored in the node
       * @param nextItem the reference to the next node in the list
      public Node(Card newItem, Node nextItem)
        data = newItem;
        next = nextItem;
       * setItem - stores a new value in data
       * @param newItem the object reference to be stored in the node
      public void setItem(Card newItem)
        data = newItem;
       * setNext - stores a new value in next
       * @param nextItem the reference to be stored in next
      public void setNext(Node nextItem)
        next = nextItem;
       * getItem - returns the reference stored in data
       * @return a reference to the data stored in the node
      public Card getItem()
        return data;
       * getNext - returns the reference stored in next
       * @return the reference stored in next
      public Node getNext()
        return next;
    }

  • Property node of a control inside of cluster inside an array

    I've created a control that has a cluster made of a Boolean, a String and a Numeric.  Then in my front panel I've created an array of these custom controls.  I would like to have access to the property of the controls inside of the cluster within the array.  ie, I want to change the color of the Boolean or make it blink, or "disable and gray" the text box.  I think I'm on the right track, or maybe I'm on the wrong path.  I've attached and example VI (testtray.vi) and the control that I'm using (UUT_Display.ctl).  Please excuse the use of a Flat Sequence Structure, I know it's poor programming practices, but I just wanted to throw something together.
    Any help would be appreciated.
    kevin
    Solved!
    Go to Solution.
    Attachments:
    testTray.vi ‏19 KB
    UUT_Display.ctl ‏5 KB

    I have enclosed a quick and dirty example of replicating the blinking in an array of clusters.  You can turn it on and off, but as we have noted, only for all of the elements.  If you were only showing one element of the array you could change properties based on which element was displayed.  You probably want to see them all.  In that case, you could use a cluster of clusters.  This may be a pain, but I would suggest that you use an array of clusters to do your manipulations.  Use Array->Cluster to convert to a cluster for display purposes.  Then you can manipulate the properties of the cluster.
    My guess is easier said than done, good luck.
    Attachments:
    Blink182.vi ‏98 KB

  • HT5012 I am having difficulty XMIT/REC text messages to family members using Android phones?  I have a 3GB data plan and all switches and buttons are set properly.  Any suggestions?

    I am having difficulty XMIT/REC text messages to family members using Android phones?  I have a 3GB data plan and all switches and buttons are set properly.  Any suggestions?

        Hello APVzW, we absolutely want the best path to resolution. My apologies for multiple attempts of replacing the device. We'd like to verify the order information and see if we can locate the tracking number. Please send a direct message with the order number so we can dive deeper. Here's steps to send a direct message: http://vz.to/1b8XnPy We look forward to hearing from you soon.
    WiltonA_VZW
    VZW Support
    Follow us on twitter @VZWSupport

  • Convert byte array to table of int

    [http://www.codeproject.com/KB/database/PassingArraysIntoSPs.aspx?display=Print|http://www.codeproject.com/KB/database/PassingArraysIntoSPs.aspx?display=Print] Hello friends.
    I'm pretty new with PL/SQL.
    I have code that run well on MSSQL and I want to convert it to PL/SQL with no luck.
    The code converts byte array to table of int.
    The byte array is actually array of int that was converted to bytes in C# for sending it as parameter.
    The TSQL code is:
    CREATE FUNCTION dbo.GetTableVarchar(@Data image)
    RETURNS @DataTable TABLE (RowID int primary key IDENTITY ,
    Value Varchar(8000))
    AS
    BEGIN
    --First Test the data is of type Varchar.
    IF(dbo.ValidateExpectedType(103, @Data)<>1) RETURN
    --Loop thru the list inserting each
    -- item into the variable table.
    DECLARE @Ptr int, @Length int,
    @VarcharLength smallint, @Value Varchar(8000)
    SELECT @Length = DataLength(@Data), @Ptr = 2
    WHILE(@Ptr<@Length)
    BEGIN
    --The first 2 bytes of each item is the length of the
    --varchar, a negative number designates a null value.
    SET @VarcharLength = SUBSTRING(@Data, @ptr, 2)
    SET @Ptr = @Ptr + 2
    IF(@VarcharLength<0)
    SET @Value = NULL
    ELSE
    BEGIN
    SET @Value = SUBSTRING(@Data, @ptr, @VarcharLength)
    SET @Ptr = @Ptr + @VarcharLength
    END
    INSERT INTO @DataTable (Value) VALUES(@Value)
    END
    RETURN
    END
    It's taken from http://www.codeproject.com/KB/database/PassingArraysIntoSPs.aspx?display=Print.
    The C# code is:
    public byte[] Convert2Bytes(int[] list)
    if (list == null || list.Length == 0)
    return new byte[0];
    byte[] data = new byte[list.Length * 4];
    int k = 0;
    for (int i = 0; i < list.Length; i++)
    byte[] intBytes = BitConverter.GetBytes(list);
    for (int j = intBytes.Length - 1; j >= 0; j--)
    data[k++] = intBytes[j];
    return data;
    I tryied to convert the TSQL code to PL/SQL and thats what I've got:
    FUNCTION GetTableInt(p_Data blob)
    RETURN t_array --t_array is table of int
    AS
    l_Ptr number;
    l_Length number;
    l_ID number;
    l_data t_array;
    BEGIN
         l_Length := dbms_lob.getlength(p_Data);
    l_Ptr := 1;
         WHILE(l_Ptr<=l_Length)
         loop
              l_ID := to_number( DBMS_LOB.SUBSTR (p_Data, 4, l_ptr));
              IF(l_ID<-2147483646)THEN
                   IF(l_ID=-2147483648)THEN
                        l_ID := NULL;
                   ELSE
                        l_Ptr := l_Ptr + 4;
                        l_ID := to_number( DBMS_LOB.SUBSTR(p_Data, 4,l_ptr));
                   END IF;
                   END IF;
    l_data(l_data.count) := l_ID;
              l_Ptr := l_Ptr + 4;
         END loop;
         RETURN l_data;
    END GetTableInt;
    This isn't work.
    This is the error:
    Error report:
    ORA-06502: PL/SQL: numeric or value error: character to number conversion error
    06502. 00000 - "PL/SQL: numeric or value error%s"
    I think the problem is in this line:
    l_ID := to_number( DBMS_LOB.SUBSTR (p_Data, 4, l_ptr));
    but I don't know how to fix that.
    Thanks,
    MTs.

    I'd found the solution.
    I need to write:
    l_ID := utl_raw.cast_to_binary_integer( DBMS_LOB.SUBSTR(p_Data, 4,l_ptr));
    instead of:
    l_ID := to_number( DBMS_LOB.SUBSTR (p_Data, 4, l_ptr));
    The performance isn't good, it's take 2.8 sec to convert 5000 int, but it's works.

  • I am having difficulty: we are running a windows server 2003 - mail and outlook support 2007 and upwards, how do I get the brand new apple machines to work with the 2003 version of server

    I am having difficulty: we are running a windows server 2003 - mail and outlook support 2007 and upwards, how do I get the brand new apple machines to work with the 2003 version of server

    I may be way out, but do you know about this product, would it help integrate the Macs for you.
    https://www.thursby.com/sites/default/files/images/ADmitMacv8_SPD.pdf

  • How can I convert an array off byte into an Object ?

    Hi folks...
    I�m developing an application that comunicates a PDA and a computer via Wi-Fi. I�m using a DataStream ( Input and Output ) to receive / send information from / to the computer. Most off the data received from him is in the byte[] type...
    How can I convert an array off byte ( byte[] ) into an Object using MIDP 2.0 / CLDC 1.1 ?
    I found on the web 2 functions that made this... but it uses a ObjectOutputStream and ObjectInputStream classes that is not provided by the J2ME plataform...
    How can I do this ?
    Waiting answers
    Rodrigo Kerkhoff

    There are no ObjectOutputStream and ObjectInputStream classes in CLDC. You must know what you are writing to and reading from the DataStream. You should write the primitives like int, String to the DataOutputstream at one end and read those in exactly the same sequence at the outher end using readInt(), readUTF() methods.

  • How do I convert an array of BYTES (where each BYTE represents a bit) into a single Hex number?

    I am reading a signal from a USB-8451. This signal is stored as an array where each element represents a bit in the signal, but is stored in the array as a byte. How do I convert this array into a single Hex number. I attatched what I have so far, there are a few extra things to help me see what ia going on. One code uses Queue and the other uses arrays, let me know if you can help.
    Attachments:
    845x_EEPROMarrays.vi ‏27 KB
    845x_EEPROM.vi ‏26 KB

    mkssnwbrd wrote:
    ... so we can't introduce any other forms of signals or power into the circuit other than what the circuit already has. Trithfully I don't really know how I2C devices work, but my mentor here says that we can't use an I2C method becuase it will introduce voltage into the circuit and may damage out TCON chip.
    That makes absolutely no sense. What do you think is happening when you write the digital lines? You're setting a pin high. That voltage is being generated by the 8451x. I think you're not understanding what your mentor is saying. If it's an I2C device then you should be able to use the I2C function to simply talk to it. You still have not indicated what the device is, so there's little more I can say about that aspect of it.
    As far as the conversion is concerned, you basically need loop through your array of "bits", taking 16 at time since you said you have 16-bit values. It's not clear from your code whether your eventual goal is to get a numeric value or a string. This does not appear to be a subVI, so a simply numeric indicator formatted to display in hex format should be quite adequate. The array you are generating is an array of rings, whose datatype is I32, but they will have values of 0 or 1. You can use the example just posted, or you can use the attached variation.
    Attachments:
    Bits to Hex 2.vi ‏17 KB

Maybe you are looking for