Array of Boolean to String

Hello All,
I have a small coding challenge that has been whipping me all day.   I have a 19 element boolean array that I would like to convert to a string without delimiters("0000000000000000000").    Within a for loop I use a "Select" followed by a "Number To Decimal String."   Once outside the loop then use the "Array To Spreadsheet String" function on the indexed output.    I tried using a blank delimiter input on the "Array To Spreadsheet String" function but that reverts back to tabs.   Bummer.   I'll keep plugging away trying different functions and constructs, but this feels harder than it really should be.    Any fresh prespectives would be greatly appreciated!
Sincerely,
Zach
Solved!
Go to Solution.
Attachments:
array_of_clusters_to_XLS (SubVI).vi ‏31 KB

super-neuron wrote:
  I have a 19 element boolean array that I would like to convert to a string without delimiters("0000000000000000000").
"Boolean to 0,1" - > "Number to decimal string" -> "concatenate array". No loop needed.
EDIT: looks like smercurio beat me to it.
Message Edited by altenbach on 08-05-2008 02:09 PM
LabVIEW Champion . Do more with less code and in less time .
Attachments:
BooleanArrayToText.vi ‏8 KB
BooleanArrayToText.png ‏9 KB

Similar Messages

  • Converting a string of numbers into an array of booleans

    For a homework assignment, I need to convert a string of numbers into an array of booleans.  The string is a bunch of random numbers (0-9) in sequence, with no spaces.  It looks something like this: 0123452348949230740329817438120947392147809231419.  I need to make it so that each even number represents a "True" boolean and so that each odd number represents a "False" boolean.  I think that I first need to convert each element of the string into a number, and then use a case structure (or something) to say, for each element of the array, "If even, then true.  If odd, then false," but I could be wrong.  Any suggestions?

    billko wrote:
    Hooovahh wrote:
    billko wrote:
    Sounds reasonable.  Think about the definition of "odd" and "even" and it will make life a lot easier. 
    I know you are trying to be vague but I'd like to give a key hint.  Use the Quotient and Remainder function.
    LOL maybe that was one of the objectives of the homework. 
    To be fair it sounds like there is more work that is needed.  A new user of LabVIEW will have a hard time figuring out how to process each character one at a time when it isn't in an array.  
    It's just that most people (me at least) stopped thinking about division with quotient and remainder after basic algebra.  I then of course changed my way of thinking when I used LabVIEW.  Still most of the time when you use division you want to know the fractional part as a decimal.  Thinking this way makes the problem more difficult then it needs to be.
    Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
    If 10 out of 10 experts in any field say something is bad, you should probably take their opinion seriously.

  • Can I Bind a Front Panel LED to a specific element in an array of booleans?

    In LabVIEW 2010 I have a string of LEDs. I have and array of boolean values that contain the values that the LEDs should indicate.
    What is the best way to connect the LEDs to elements in the array of booleans?
    Can I Bind a Front Panel LED to a specific element in an array of booleans?
    How is this done?
    Can anyone show sample code?
    Solved!
    Go to Solution.

    Imagine that you have an I/O card that provides 128, 256 or 1024 digital inputs and the requirement is to have an LED on the front panel to represent the state of each digital input. This frequently occurs.
    Wiring that many digital inputs individually is a royal pain and then some !
    It would make sense to have one shared variable as an array of Booleans that represents the status of all inputs and then use data binding instead of wiring each individually. The individually wiring would violate all recommendations on diagram size and fan out.
    Frequently scanned For loops to update all of the LEDS would take alot of CPU time.
    Wouldn't it be MUCH better if PSP could be used to update the LEDs whenever the data changed (as it is supposed to do) ?
    In my case I have a LabVIEW Yaskawa servo driver that provides me information about 16 servo drives that may be connected. I have LEDs on the front panel to represent some of that status for each individual drive. But Yaskawa provides the information on the drives as an array of clusters of information for each drive, which I perform some business logic on and turn into shared array of Booleans to feed the LEDs (and some banks of switches as well).
    Unfortunately LabVIEW does not seem to have any way to bind the LEDs (and Switches) to individual elements in the shared array of Booleans. It is just not that smart. Even with only several banks of 16 LEDs and Switches, wiring them individually using Decimate Array of Index Array functions is a royal pain and makes the block diagrams very large. It would be much worse and almost unreasonable to do if the size of the information was much larger.

  • How can I change the properties of only one element in an array of booleans?

    I'm displaying an array of booleans to my operators, with each boolean in the array representing some system status check.  Some of these checks are critical and some are not, therefore I want some of these booleans to have a different color when in the TRUE state (Red for the critical ones and Yellow for the non-critical ones).  I can change the boolean colors with a property node, but that effects every element in the array.  Is there any way to change a property of an individual element in an array?  I know that I could take the incoming array and break it into two arrays - one for critical and one for non-critical, but this system is replacing an older system and the operators are accustomed to seeing their indicator lights a certain way and I'm trying to replicate what they had exactly.

    Here's what I had in mind
    Of course you can use as many colors as you want.
    Message Edited by altenbach on 12-21-2005 04:53 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    LEDarray.png ‏7 KB
    ColorArray3.vi ‏23 KB

  • Array of booleans

    I have an array of booleans defined as follows:-
    Boolean [] isComplete = new Boolean[noOfBooleans];What I am trying to do is to continue a loop till all the values of this array are set to true. What I have tried is
    do {
        for (int i = 0; i < isComplete.length; i++) {
            if(isComplete) {
    break;
    }while(true);
    but it would break if anyof these booleans is true and I am not sure how to put an && condition in there. Any help would be great.
    Edited by: LisaM on Nov 10, 2009 11:26 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    LisaM wrote:
    ^you are right, actually I am dealing with threads here, what I am trying to do is to start a number of independant threads, and as these threads complete set the isComplete boolean to true. But I am unable to check when all the threads have finished. If you want to wait for the thread to complete, as opposed to just knowing when they complete, use Thread.join:
    List<Thread> threadList = new ArrayList<Thread>();
    for (...) {
      Thread th = new Thread(...);
      th.start();
      threadList.add(th);
    for (Thread th : threadList) {
      th.join();
    // when we get here, all the threads we started are doneAs for your code, if you do decide to continue with your initial approach (fixing the code so it actually works, of course), I have a few suggestions.
    1. A busy-wait loop like that will kill performance. Use wait/notify or sleep so that test loop doesn't eat up all your CPU.
    2. You'll have to synchronize all access to the array, otherwise the testing thread may never see the writing threads' updates.
    3. You may want to use BitSet instead of an array. It seems a little cleaner to me, but it won't make any real difference. You'll still have to sync all access to it.
    Finally, depending one what you're really trying to do, you may find some of the tools in the java.util.concurrent packages easier to work with than this low-level threading stuff.

  • Boolean to String - surely there's an wasy way!

    How do i convert a boolean to its String represetation?
    This is how I do it:
    boolean primitiveBool = false;
    Boolean objectBool = new Boolean(primitiveBool);
    String booleanAsString = objectBool.toString();
    Surely there is a shorter more efficient way?
    Thanks.

    boolean bool = true;
    String asString = "" + bool;I think better would be Boolean.toString(boolean) or
    String.valueOf(boolean) as you're not creating an
    extra, unused String object.Plus a StringBuffer object.Moreimportantly (IMAO), the code is more directly expressing your intent. "Give me a String representation of this boolean" vs. "Give me a String that is a concatenation of the empty string and the string representation of this boolean."

  • Boolean to string convertion

    HI,
    Is there any tool in labview 8 to convert string to boolean or boolean to string . The source is of boolean type and the sink is boolean type.
    Thanks
    SR

    I don't know why you start a new thread instead of adding to your existing thread here:
    http://forums.ni.com/ni/board/message?board.id=170&message.id=193342
    In any case, most answers so far have dealt with formatting a boolean into a humanly readable string and back. Actually, I am not sure if that is what you want, because you talk about converting, not formatting.
    What exactly do you want to do?
    For example if you need to send a boolean via TCP, you need to convert it to a string, but it would make little sense to do any fancy formatting, turning a single byte into a longish humanly readable string. In this case you would just typecast to string, then cast it back to a boolean on the other end.
    The image shows one possibility.
    Message Edited by altenbach on 07-05-2006 10:40 AM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    Bool-string-bool.png ‏3 KB

  • Is there an example vi for converting an array of boolean to list an array of Int based on a selected T/F state?

    I would like to use arrays to minimize code.
    I am trying to generate an array of int base on an array of boolean randomly selected.

    You can try using 'Boolean to 0,1.vi', found in the Boolean palette: this vi converts a scalar, array or cluster of booleans to a scalar, array or cluster of word (I16 integers).
    To use it, simply wire an array of booleans (indicator) to its left, and an array of integers (control) to its right et voilà.
    Roberto
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • Array of Ring to string value for creating a table

    I want to convert an array of ring to string and generate a table from it.
    But using property node for converting each ring is changing all the value of the table!
    each array represents different register!hence required to change  for different array! 
    i am hereby attaching a  Vi!
    Solved!
    Go to Solution.
    Attachments:
    Untitled 1.vi ‏1944 KB

    How about this simple solution? Array of a ring control to Array of string.
    /Y
    Message Edited by Yamaeda on 04-13-2010 08:36 AM
    LabVIEW 8.2 - 2014
    "Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
    G# - Free award winning reference based OOP for LV

  • !! help using: public static Boolean valueOf(String s)

    I am trying to use this simple function to convert a string value to a boolean. According to the documentation for this Boolean method (public static Boolean valueOf(String s)), this should work:
    Example: Boolean.valueOf("True") returns true.
    As a test, I tried to run this line of code:
    tmp_bool = Boolean.valueOf("True");
    I get this compilation error:
    test_file.java:10: incompatible types
    found : java.lang.Boolean
    required: boolean
    tmp_bool = Boolean.valueOf("True");
    .....................................^
    According to the documentation for SDK 1.4, there is a new function:
    public static Boolean valueOf(boolean b)
    It seems like the commpiler is focusing on this new version of the valueOf() method, and ignoring the case where a String is the parameter. Why won't it use the version that takes a String? What confuses me even more is that I am running version 1.3.1, and the new valueOf(boolean b) function is not mentioned in its documentation.
    Am I somehow using the method wrong?
    Thanks!

    OK, I think I understand now. Thanks.
    Let me make sure i have this right...
    So basically, if you use variable types of Boolean and need to pass them to methods that take booleans, would you have to call the booleanValue method first?
    ex:
    Boolean bool_obj;
    //example method that takes a boolean
    //test_method(boolean b);
    test_method ( bool_obj.booleanValue() );
    is that right?

  • Array to one line string

    hi i have an array
    as this
    0123456
    6789456
    but i want my array to be as 01234566789456...
    anyone can help me on tis

    Hi jeyanthi,
    if you connect your array to the "Concatenate Strings" function, then you get what you want.
    Mike

  • Converting Image to Byte Array and then to String

    Hi All...
    Can anyone please help me. I have got a problem while converting a Byte array of BufferedImage to String.
    This is my code, First i convert a BufferedImage to a byte array using ImageIO.wirte
    public String dirName="C:\\image";
    ByteArrayOutputStream baos=new ByteArrayOutputStream(1000);
    BufferedImage img=ImageIO.read(new File(dirName,"red.jpg"));
    ImageIO.write(img, "jpg", baos);
    baos.flush();
    byte[] resultimage=baos.toByteArray();
    baos.close();
    Then i tried to convert this byte array to a string
    String str=new String(resultimage);
    byte[] b=str.getBytes();
    This much worked fine. But when i reversed this process to re-create the image from that string. i found the image distroted.
    BufferedImage imag=ImageIO.read(new ByteArrayInputStream(b));
    ImageIO.write(imag, "jpg", new File(dirName,"snap.jpg"));
    I got this snap.jpg as distroted.
    Please help me i have to convert the image to a string and again i have to re-create the image from that string.

    To conver the bytearray to string use base64.encoding
    String base64String= Base64.encode(baos.toByteArray());
    To convert back use Base64.decode;
    byte[] bytearray = Base64.decode(base64String);
    BufferedImage imag=ImageIO.read(bytearray);

  • Como obtener un array dbl de un string de 2 bytes

    como obtener un array dbl de un string de 2 bytes
    Adjuntos:
    dbl.png ‏37 KB

    Hola, un string de dos bytes no puede contener un double ya que el dbl es un número de 8 bytes.
    Acaso estás recibiendo alguna medicion de un conversor de 16 bits (un instrumento externo, un PIC o algo así)? Si es así el valor correspondiente en la unidad de medición (V, A, RPM...) debe calcularse con
        bits recibidos / 65536 * máximo de la medición
    Ejemplo: en un voltímetro de 100V / 16 bits, un valor de 8000 (bits) equivale a una medición de 12.207V
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • Incompatible types required boolean found string

    I am trying to set a value for a variable called Location when ever the value for the location is "AFRICA"
    I need to reset it to be "55555".
    What I am getting is that 'Incompatible types required boolean found string' under the if statemant. Can anyone shade some light on this?
    String Location = filename.substring(12,17);
    String AP = "AFRICA";
    System.out.println(Location);
    if (Location = AP)
    System.out.println(Location);
    Location = "55555";
    thanks

    rp0428 wrote:
    The IF condition needs to be a BOOLEAN. The '=' is used to do an assignment. The boolean would be '=='.
    But to compare strings why aren't you using
    if (Location.equalsIgnoreCase(AP) {
    To stress this a little more:
    <tt>==</tt> applied between References will compare the Adresses they point to. This means this will only be true if both References point to the identical Object. @Test
    testStringEquality(){
       String s1 = "my Test"
       String s2 = "Test"
      Assert.assertTrue("This strings are equal",s1.equals("my "+s2));
      Assert.assertFalse("This strings are not identical",s1 == ("my "+s2));
    }So use <tt>==</tt> only for primitive number types (those starting with a lower case letter).
    bye
    TPD

  • Array access notation with strings?

    I may be confused, but I thought you could use array access
    notation with strings. Can someone tell me why this code doesn't
    work (or suggest new code):
    the code is meant to rewrite the block of text in tText at a
    rate of one character per frame... (when the function is called
    once per frame) but it doesn't work.

    DZ-015,
    > I may be confused, but I thought you could use
    > array access notation with strings.
    It's made for objects, actually. The array access operator,
    [], allows
    you to access elements from an Array instance and also lets
    you access
    properties from any sort of object. The "trick" it provides,
    in this latter
    case, is that you can refer to these properties -- within the
    brackets --
    with strings, so it's often used to reference objects
    dynamically.
    > var sWorkingText:String = tText.text;
    Here you've declared a String variable and set it to the
    TextField.text
    property of some textfield. So far, so good.
    > var sNewText:String = oPhotoText[sPageFocus];
    Here, you've declared a String variable, but it seems that
    you're
    setting it to a property of the oPhotoText object. That's now
    how this
    works.
    The array access operator allows you to *use* strings to get
    at an
    object's properties:
    // functionally equivalent
    someObject.property1
    someObject["property" + 1];
    var x:Number = 1;
    someObject["property" + x];
    Does that help?
    David Stiller
    Adobe Community Expert
    Dev blog,
    http://www.quip.net/blog/
    "Luck is the residue of good design."

Maybe you are looking for

  • Getting the required property of an item in a bean

    Hello all, is it possible to get the required property of e.g. a VTextField inside a PJC? I am trying to write a bean that iterates through all the components of a form a puts a red border on all fields marked as required in Forms. I cannot find an a

  • Fund Center and equipemnt master link

    Hi! In our org. Funds Management is active. Now I want to Test Equipment calibration(Internal). I have created Equipment, maintain the strategy and schedule the same as daily. Now my order has created but it is not released automatically. Reason is "

  • Change the Default Authentication back to secLDAP after SAP kit 3.1 Install

    My client would like to switch the default authentication back to secLDAP after the installation of the SAP kit. What steps do we need to take to make this happen on Unix/Weblogic 9.2? Typically it is a simple chane in the Web.xml, but we are having

  • Using Pages to edit existing HTML??

    How useful/user-friendly is PAGES for this: I have some pre-existing Web pages, created for me by someone using Dreamweaver & GoLive. All I want to do is edit the text and images, maybe mess with the tables? Possible?? Or more of a hassle than it's w

  • Lion Address Book question (version 6.1.2)

    In Lion's address book (version 6.1.2), after importing a v-card, the application doesn't automatically navigate to the newly imported v-card (like it did in Leopard).  How can I get it to navigate automatically to the newly imported v-card, right af