Programatic control of float array precision?

Using LV6.1, I can't figure out how to control the array precision similar to the attached example's control of a simple float control.  Can it be done?
Attachments:
Untitled.vi ‏20 KB

Hi RAMaston,
you can create a property node of the numeric element in the Array not from the entire array. Select the single numeric element in the array and create the property of it in the same way like the property of the other numeric indicator.
Mike
Message Edited by MikeS81 on 03-19-2008 02:34 PM

Similar Messages

  • How Do You Populate A Spark List Control With An Array?

    Hello, all,
    Sorry to come accross so frustrated, but how in the name of God do you populate a Spark list control with the data in an array?  You used to be able to do this with the mx:List control, but the guys developing Flex just had to make things more difficult than they need to be!  I am more of a code purist and prefer doing things the way they have been done for decades, but apparently nothing can ever stay simple!
    I simply want to populate a list control with an array and this shouldn't be rocket science!  I found out that I must use a "collection" element, so I decided that an arrayCollection would be best.  However, after searching Adobe's documentation about arrayCollections, I am lost in a black hole of data binding, extra lines of code just to add a new element, the need to sort it, etc...!
    Here is my code:
    var pendingArray:ArrayCollection = new ArrayCollection();
    for ( var i:int = 0 ; i < queue.length ; i++ )
         var item:UserQueueItem = queue[i] as UserQueueItem ;
         if ( item.status == UserQueueItem.STATUS_PENDING )
         pendingArray.addItem({label:item.descriptor.displayName,descriptor:item.descriptor});
    Here is the relevant MXML:
    <s:VGroup>
         <s:List id="knockingList" width="110" height="100"/>              
    </s:VGroup>
    I'm not getting any errors, but the list is not populating.
    I have seen several examples where the arrayCollection is declared and populated in MXML:
            <mx:ArrayCollection id="myAC">
                <!-- Use an fx:Array tag to associate an id with the array. -->
                <fx:Array id="myArray">
                    <fx:Object label="MI" data="Lansing"/>
                    <fx:Object label="MO" data="Jefferson City"/>
                    <fx:Object label="MA" data="Boston"/>
                    etc...
               </fx:Array>
            </mx:ArrayCollection>
    That may be fine for an example, but I think this is a rare situation.  Most of the time I would image that the arrayCollection would be created and populated on the fly in ActionScript!  How can I do this?
    Thanks in advance for any help or advice anyone can give!
    Matt

    In your post it seemed like you were trying to take care of many considerations at once: optimization, design, architecture.  I would suggest you get something up and running and then worry about everything else.
    If I use data binding, then I will probably have to declare the  arrayCollection as a global variable and then I'll have to write 100 or  so extra lines of code to addItem(), removeItem(), sort(), etc...  It  just seems like too much overhead.
    I believe you may have some misconceptions about databinding in general.  You won't have to make it a global variable and you certainly won't need an extra 100 lines of code.  If you did this forum would be a very , very quiet place.
    I don't want to use data binding because the original array is refreshed  often and there is one function called by an event that re-declares the  arrayCollection each time, populates it with the array, and then sets  it as the list's dataprovider.
    That is the beauty of the ArrayCollection, it can handle the updates to its source Array. I don't know if you need to redeclare the ArrayCollection, resetting the source to the new Array allows everyone involved to keep their references so you don't have to worry about any "spooky" stuff going on.

  • Create an image from float array?

    Dear All,
    I have a float array containing pixel values. From that array I want to create an image (let's say in JPEG format).
    How should I do that?
    thanks

    Hi musti168,
    You're going through your entire image pixel-by-pixel and getting each of their values - why don't you just use the IMAQ ImageToArray function?  
    On this forum post I found an example of IMAQ ArrayToImage: http://forums.ni.com/t5/LabVIEW/IMAQ-arraytoimage-​example/td-p/68418
    You can use some of the IMAQ Image Processing palette to change the image to gray scale - possibly a threshold.
    Julian R.
    Applications Engineer
    National Instruments

  • Float Arrays and hashcodes

    Hi,
    I have some problems with generating unique hash codes for float arrays.
    The following code will result in "true" on my JVM (JRE 1.6):
    System.out.println(Arrays.hashCode(new float[]{0,1,2,3,6,9}) == Arrays.hashCode(new float[]{0,1,3,6,8,9}));Does anyone have an idea how to generate a truly unique hashcode for float arrays?
    Thanks for your help,
    Dieter

    JoachimSauer wrote:
    dkleinrath wrote:
    JoachimSauer wrote:
    But again: you don't usually need a perfect hash. Why do you think you need one?I use static HashMaps to store meta information about specific arrays. I also use a HashSet to search for unique arrays in a big collection of arrays.That's ok. Both HashMap and HashSet can work perfectly with in-perfect hash code (obviously, since perfect hash codes are not possible in many situations).
    What they can not handle is .equals() being "wrong" (i.e. inconsistent with hashCode()).
    This means that you can't directly use float[] as keys.
    You could build a simple wrapper around float[] to be used as keys, 'though.I just tried that and it works like a charm.
    Thank you very much for your help.

  • How to store (non-persistent) multiple float[] arrays.

    Hi;
    In a situation where an object needs to store multiple float arrays, how can I use a 2 dimensional array to store them? I can't use a collection since an array is a primitive.
    I would use a 2 dimensional array, but my keys to get/set these arrays are ints. So I cant do a "int i[][]", nor a "float f[][]".
    Any ideas?
    Thanks;
    -nat

    You could make a Map (such as HashMap) with an
    Integer (java.lang.Integer) key and a "int []" or "float []" as a value (an array is an Object, so can be put as a value).You kid me not! I need to review my basics.
    I simply didn't know that an array of primitives can be stored as a value in a map.
    Thank you!
    -nat

  • Converting float array to Float array

    Hi, is there any efficent way to convert float[][] to Float[][] without iterating the array and creating Float object for each float data? I have a method performing calculations based on a 2D array( float[][]) and then need to store the result in a TreeMap data structure. The "put" method for TreeMap ask Object type.
    Thanks in advance!

    1) No
    2) An array of float is an object as well:
    Object obj = new float[]{1.0, 2.0, 3.0};3) What you want to store? If your structure is somewhat like this:
    float[][] f = {
       { 1.0, 2.0, 3.0 },
       { 4.0, 5.0, 6.0 },
    };and you want to "index" your TreeMap by the first element of each row of your float[] array, you could do something like this:
        SortedMap sm = new TreeMap();
        sm.put(new Float(f[0][0]), f[0]); // Arrays are objects as well
        sm.put(new Float(f[1][0]), f[1]); //and so on.

  • How to make VIs as "Fp Read (Float Array -IO)" available to take a measurement?

    I can't succeed in launching a fieldpoint VI cause I don't find the VI FP Read (Float Array -IO).vi. If I have well understood these VIs (like FP Open and other) are made available when installing the Field Point Server. In my case nothing occurs. What can I do?
    thanks.

    Hello,
    If you have the FieldPoint drivers installed in the computer where you are opening this VI, then you should find the FP Read.VI on the functions palette of the Block Diagram (right click on any open space of the block diagram => All function => NI Measurements => FieldPoint)
    If this VI that you can't find is actually a subVI that was made by the person that made the program, just save it from where it was developed and copy it on the new computer.
    If this is unclear or if you have any more questions, please let me know.
    Regards,
    LA

  • How can I set the caption text of picture controls inside an array or how can I choose which array element is assigned using the array elements caption text property.

    I have 8 picture controls inside an array and I would like to set the caption text of these controls.
    I have used the property node of the array and used the array elements property caption text to set the text.
    The problem is however that I set the same text to all the picture controls inside the array.
    My question is how to set caption text of specific elements (Picture control) that I have so far only been able to access using the array elements caption text property.

    Some more help
    1 You could use the caption of the array and place it in front of the selected picture and update that using property nodes.
    2 Like Norbett said if you use a cluster of pictures then their caption can be updated individually.
    Here is a an example that demonstrates the above
    David
    Attachments:
    Modify the Captions Of Pictures.vi ‏83 KB

  • How to read binary file into a 2D float array??

    Hi All,
    I really need help to get this one as I am stuck and can't seem to find any way out of it. I am given a '.dat' file that has float values in it. I want to read this file in java and put it in a 2D float array. The file has basically a matrix of float values. What I want to do is to read this binary file and put all its data into 2D float array (float [] []) so that I can use it in my program. Is there a way to read file like this? I did find a similar matlab code (below) but cant seem to find anything in java and i really want to do this in java only.. I will appreciate ur help in this one.
    thanks very much
    Nitya
    fid = fopen('datafile.dat');
    A = fread(fid,[50 50],'float32');
    fclose(fid);

    I shud have shown the two ways that i Already tried. here they are..
    first one using DataInputStream and then trying to readFloat()
    DataInputStream dis = ....
    Float f = dis.readFloat();This code gives code gives me some random values like this.. (i had a loop)
    5.8758974E-14
    -0.41055492
    1.5724557E-30
    1.06822824E14
    -1.91934371E15
    3.43829601E13
    Other way i tried was this.. which seems right but here i have to convert byte to float and i thnk that code is giving some different results (slightly different float values) not sure why....may be my indexing of the array is wrong to make it a matrix.. or something else...
    is.read(bytes, offset....);
    int cnt = 0;
    int j = 0;
    for (int start = 0; start < offset; start = start + 4) {
      if(j<50){
           myarray[cnt][j] = this.arr2float(bytes, start);
             System.out.println(cnt + "-" + j + " = " + myarray[cnt][j]);
           j++;
    }else{
      if(cnt < 50){
           cnt++;
           j = 0;
      }else{
           break;
    public float arr2float (byte[] arr, int start) {
              int i = 0;
              int len = 4;
              int cnt = 0;
              byte[] tmp = new byte[len];
              for (i = start; i < (start + len); i++) {
                   tmp[cnt] = arr;
                   cnt++;
              int accum = 0;
              i = 0;
              for ( int shiftBy = 0; shiftBy < 32; shiftBy += 8 ) {
                   accum |= ( (long)( tmp[i] & 0xff ) ) << shiftBy;
                   i++;
              return Float.intBitsToFloat(accum);
    Not sure if i am missing some other way to do this...                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Sorting a float array

    How do you use the sort(float[] a), i want to find the smallest number in my float array? help would be appreciated thanks.

    float smallest=0;
    float[] smallestCostArray = new float[25];     
    for(int i=0;i<stageSize;i++)                  
              if(smallest < smallestCostArray){
                   smallest = smallestCostArray[i];
    this is my code for trying to find the smallest , but i get a "operator < cannot be applied to float,float[]" error when trying to compile.
    Message was edited by:
    dets00b
    Message was edited by:
    dets00b

  • How do I convet C Float array to Java Float Array.

    Hi All,
    I am using some C function in the JNI which will return Float array.
    How do I convert the Float C array elements to jfloatArray elemets. And my native method implementation should return jfloatArray.
    If any one of you have the sample code please send reply.
    regards
    Ravi Kumar

    to return the c array to jfloat array do the following:
    ur function should have a return type of jfloat
    this is for c++::
    jfloatArray ret = (jfloatArray)env->NewFloatArray(length of the array);
    env->SetFloatArrayRegion(ret,index,number of retunrs,jfloat *);
    for c u just have to include the env variable
    jfloatArray ret = (jfloatArray)env->NewFloatArray(env,length of the array);
    return ret;
    this will work when u give the array indexes properly.
    regards
    vidhya

  • Missing FP READ (Float Array-IO).vi & FP WRITE (Float Array-IO).vi

    I am a complete newbie. I am trying to use the Field Point Express vi to collect data from some Field Point modules. When I go to past the Field Point Express VI into my sheet, the applications starts looking for a couple of sub-vi's. It is missing the FP Read (Float Array-IO).vi and the FP Write (Float Array-IO).vi. I am not sure if I erased these accidentally or what. Is there a way to replace these missing VIs?

    These vi's are usually located in C:\Program Files\National Instruments\LabVIEW XX\vi.lib\FieldPoint\Polymorphic Read.llb. First, check if they are present and try to manually link them when the LV is trying to load them. Otherwise, you can try to uninstall your FP drivers and then perform a re-install. The FieldPoint drivers are located in your Device Drivers CD.
    Hope this helps.

  • FP Read (Float Array -IO).vi request

    Whenever I use the FieldPoint palette item under Input or Output I get a message asking for FP Read (Float Array -IO).vi and then FP Write (Float Array -IO).vi This vi is not present anywhere on my harddrive and a search of this website came up with nothing. The Fieldpoint palette item does not work properly when I choose Cancel - the input or output value becomes an integer (I think) that does not actually read or write data. What is this error, and how do I fix it?

    The VIs that are missing should be in the ...LabVIEW\vi.lib\FieldPoint\Polymorphic Read.llb and ...LabVIEW\vi.lib\FieldPoint\Polymorphic Write.llb files. If you are missing them, it is likely that your installation has become corrupted. You can copy the above files from a different computer or re-install the NI-FieldPoint driver.
    Regards,
    Aaron

  • Floating point precision of "Flatten to XML"

    It appears that the "Flatten to XML" function (LV 7.1.1) truncates floating point numbers to 5 decimal places.  This is a rather annoying limitation, since I'm trying to store a relative time in hours, accurate to the second (chosen by a previous coder that I have to be compatible with - otherwise I'd just use seconds).  Is there a workaround to this?  (other than multiplying by some power of 10 before flattening, and dividing after unflattening)
    Jaegen

    Hi Paul and Jaegen,
    I checked our databases and found entries of product suggestions and
    corrective action requests for the behavior of the limited precision
    when flattening to XML. I found an interesting reply from a LabVIEW
    developer on the request for further precision:
    The Flatten To XML primitive puposefully cuts off all numbers at 5
    digits after the decimal. There are 3 main reasons for this:
    Information regarding precision is not propagated on the wire.
    Therefore, there is no real way to know how many significant digits or
    even places past the decimal point is appropriate when data is
    flattened to XML.
    Bloat. If all floating point values printed all of the possible
    decimal digits all of the time, this would provide for some very large
    blocks of XML code.
    Given the arbitrarily complex nature of LabVIEW data, it is
    difficult to provide a method for specifying precision. For example, if
    a user has a cluster of clusters, each of which contain a single,
    double and extended representing various measurements of differing
    accuracy, how can one precision setting be applied to each of these
    values? The user would have to unbundle (and index if an array was
    involved), flatten, concatenate, and then the reverse on the unflatten
    side.
    I suggest that you go ahead and file a new product suggestion by using the "feedback" link on www.ni.com/contact.
    It would be best if you could give some detailed information on how you
    would like LabVIEW to handle different scenarios while getting around
    the above issues.
    Thanks for the feedback!
    - Philip Courtois, Thinkbot Solutions

  • How Do I Load An Animated GIF Into PictureBox Control From Byte Array?

    I'm having a problem with loading an animated GIF int a picturebox control in a C# program after it has been converted to a base64 string, then converted to a byte array, then written to binary, then converted to a base64 string again, then converted to
    a byte array, then loaded into a memory stream and finally into a picturebox control.
    Here's the step-by-step code I've written:
    1. First I open an animated GIF from a file and load it directly into a picturebox control. It animates just fine.
    2. Next I convert the image in the picturebox control (pbTitlePageImage) to a base64 string as shown in the code below:
                    if (pbTitlePageImage.Image != null)
                        string Image2BConverted;
                        using (Bitmap bm = new Bitmap(pbTitlePageImage.Image))
                            using (MemoryStream ms = new MemoryStream())
                                bm.Save(ms, ImageFormat.Jpeg);
                                Image2BConverted = Convert.ToBase64String(ms.ToArray());
                                GameInfo.TitlePageImage = Image2BConverted;
                                ms.Close();
                                GameInfo.TitlePageImagePresent = true;
                                ProjectNeedsSaving = true;
    3. Then I write the base64 string to a binary file using FileStream and BinaryWriter.
    4. Next I get the image from the binary file using FileStream and BinaryReader and assign it to a string variable. It is now a base64 string again.
    5. Next I load the base64 string into a byte array, then I load it into StreamReader and finally into the picturebox control (pbGameImages) as shown in the code below:
    byte[] TitlePageImageBuffer = Convert.FromBase64String(GameInfo.TitlePageImage);
                            MemoryStream memTitlePageImageStream = new MemoryStream(TitlePageImageBuffer, 0, TitlePageImageBuffer.Length);
                            memTitlePageImageStream.Write(TitlePageImageBuffer, 0, TitlePageImageBuffer.Length);
                            memTitlePageImageStream.Position = 0;
                            pbGameImages.Image = Image.FromStream(memTitlePageImageStream, true);
                            memTitlePageImageStream.Close();
                            memTitlePageImageStream = null;
                            TitlePageImageBuffer = null;
    This step-by-step will work with all image file types except animated GIFs (standard GIFs work fine). It looks like it's just taking one frame from the animation and loading it into the picturebox. I need to be able to load the entire animation. Does any of
    the code above cause the animation to be lost? Any ideas?

    There is an ImageAnimator so you may not need to use byte array instead.
    ImageAnimator.Animate Method
    http://msdn.microsoft.com/en-us/library/system.drawing.imageanimator.animate(v=vs.110).aspx
    chanmm
    chanmm

Maybe you are looking for