Boolean array to number

I'm not sure if this has ever been brought up before, but if so, here it is again.  Lets say I have a Boolean Array shown with 8 elements arranged horizontally.  When I read it, I usually read left to right, meaning the MSB is on the left and the LSB is on the right.  However, if I use the Boolean Array to Number funtion, this function reads right to left.  Same for the Number to Boolean Array function,  It will form the array from right to left.  This goes against normal boolean reading habits.  I know this isn't a bug because it was probably meant to operate as such.  The VI shown below illustrates what I mean.  Three questions:
Why is it done this way?
Why not make the functions configurable to read in either direction?
The term Big Endian / Little Endian applies to byte order in a 16-bit word broken into two bytes.  Does it also apply to bit order in a U8?
Here is the VI:
- tbob
Inventor of the WORM Global
Solved!
Go to Solution.
Attachments:
BoolArrayToNumber.vi ‏10 KB

tbob wrote:
Why is it done this way?
Why not make the functions configurable to read in either direction?
The term Big Endian / Little Endian applies to byte order in a 16-bit word broken into two bytes.  Does it also apply to bit order in a U8?
Bit ordering is (almost) always consistent.  The lowest order bit is bit 0.  In LabVIEW's array representation, index 0 is on the left, so you see it what you consider to be "backwards."  If this were changed, or configurable, it would be confusing when you feed only a few bits of an array into boolean array to numeric.  I expect that if I build two TRUE values into an array and then convert that to a numeric, that those two TRUE values will be in the low-order bits and the rest will be padded with zeros; anything else would puzzle me.

Similar Messages

  • Wait icon showing in boolean array to number

    Hi,
    Can anyone shed a little light on an extra little chunk of icon that I'm getting on a 'boolean array to number' function?
    I seem to be getting a small 'wait' icon superimposed in the corner. The context help entry seems the same and the functionality seems the same (as far as I can tell).
    The piece of code I'm using was converted from a newer version to V8.5 but other than that should have nothing unusual about it.
    The image below shows the offending icon with another that is fresh off the palette next to it.
    Am I missing something?
    Thanks in advance for any tips.
    All the best,
    Ian
    Solved!
    Go to Solution.

    Hello Ian,
    This is the first time I have seen this icon adaptationion in LabVIEW.  I have started trying to reproduce the issue by creating a simple VI in LabVIEW 2009 and converting it for LabVIEW 8.5.  The icon has not appeared.
    The 'Boolean array to number.vi' has properties associated with it.  You can right click on the VI in the Block Diagram and select 'Properties'.  Some options are activated depending your prefered representation.  For example, when using Fixed Point (FXP) you have the option to select a 'Desired Delta'.  Desired Delta could imply a time function. 
    Which version of LabVIEW did you convert down from?
    Is the VI running on a Windows target? Which version?
    What number data type are you converting the boolean array to?
    Regards,
    George T.
    Applications Engineering Specialist
    National Instruments UK and Ireland

  • !!!Urgent: Boolean array to number!!!

    I am trying to convert boolean array to number but I guess it has some limits. I have a boolean array containing 50 elements I want to convert that into number but it is not happening can anyone help. Its urgent.
    The best solution is the one you find it by yourself

    In a hurry I missed it. Let me explain now
    1. I tried to convert a boolean array to a number as I had more than 40 elements I was getting only zero because of the limitation of I32 I know that I have to change the representation to 64bit but dont know where to do.
    2. Then in the Boolean array to number function when I select the properties there I got the option for changing the representation to 64 bit. (This I totally missed when I was busy searchng a function outside to convert the output to a 64 bit value )
    3. Now I got what I expected.
    altenbach wrote:
    I don't understand what that means. Could you be a little bit more clear so others can learn too? Thanks!
    Thanks altenbach for asking.
    The best solution is the one you find it by yourself

  • What is the max number of bits a boolean array can have?

    Hello,
       What is the maximum number of bit that a boolean array can have?
    Regards,
      Kaspar
    Regards,
    Kaspar

    There is no real size limit. (except for the natural limits of arrays because the size is a 32bit integer, etc.)
    ... of course if you ever plan to convert it back to an integer using "boolean array to number", you better stay below 64 bits.
    Can you explain what you want to do in a bit more detail?
    Message Edited by altenbach on 05-23-2007 02:51 PM
    LabVIEW Champion . Do more with less code and in less time .

  • Boolean array number

    How do I do the opposite of the Number-to-Boolean function and convert a Boolean array back into a number?
    Thanks

    On the function pallete >>> numeric >>> Conversion>>> Boolean array to number.
    Just what you asked for.
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • How do I count the number of 1's in a Boolean Array??

    I have a boolean array of 1000 0's or 1's and want to know the number of times this array is in the 1 position.
    The array is repeated within a structure and i need a number for each iteration to be passed onto the next (using a shift register).
    Never really used boolean arrays before so none of the standard things i use seem to work?
    Thanks in Advance.
    Ross

    Ross,
    The quick easy way is to convert the boolean array to a 0-1 array from the boolean menu, then sum the array using "sum array elements" from the numerical menu.
    Bruce
    Bruce Ammons
    Ammons Engineering

  • How to change the elements number in Number To Boolean Array Function VI

    Hi, I'm working on using the DAQ digital output to control the digital input of a DAC, and I used the Number To Boolean Array Function. VI to convert the number to a Boolean array. The maximum number should be 4096, therefore it should consist of 12 elements.
    For the description of the VI, it says Boolean array returns an array of 8, 16, 32, or 64 elements, depending on the number of bits in the integer. Therefore, I change the number of the channels in task to 16, but it still doesn't work. Any suggesitions are greatly appreciated.
    Thanks!
    Possible reason(s):
    Write cannot be performed, because the number of channels in the data does not match the number of channels in the task.
    When writing, supply data for all channels in the task. Alternatively, modify the task to contain the same number of channels as the data written.
    Number of Channels in Task: 12
    Number of Channels in Data: 32
    Task Name: _unnamedTask<1B>
    Solved!
    Go to Solution.
    Attachments:
    DAC test.vi ‏47 KB

    Once you have the boolean array, you can resize it using array tools. For example you can use "reshape array" with a lenght of 12 to trim the array to 12 booleans elements (you can also use array subset).
    LabVIEW Champion . Do more with less code and in less time .

  • Number to boolean array problem

    I am tring to program a programmable attenuator using a number to boolean function.  It looks like a default number to boolean array function counts in binary (1, 2, 4, 8, 16, 32, 64, 128).  If I were to choose 8, for example, it will turn on the 4th bit.  This would be great if the attenuator (HP11713A) was able to be programmed like that.  The unit in question counts differently (1, 2, 4, 4, 10, 20, 40, 40).  So if I were to send and 8, the unit would receive only the 4th bit on, instead of the 3rd and 4th bits on.  There has got to be a way around this within Labview.  If I bang my head against the wall anymore, I may not be able to show up to work tommorow...
    I can send an image to make more sense if needed.
    Thanks for taking a look! 

    I used one of these years ago... I used a look up table then, this time I upgraded... LV 8.0
    In case you are using an older version, see pic
    smercurio_fc Sorry about the neg. rating hit no rather than post options. it was an accident. 
    Message Edited by Stradis on 08-27-2007 06:22 PM
    Paul <--Always Learning!!!
    sense and simplicity.
    Browse my sample VIs?
    Attachments:
    calcAttn.vi ‏28 KB
    calcAttn.png ‏24 KB

  • Number of 1s or 0s from a boolean array

    How to find the number of 1s or 0s from a boolean array. e.g. in 101011, there are four 1s and two 0s.
    Solved!
    Go to Solution.

    ABBPAK ha scritto:
    Hi,
    When you talk about the value change, how to predefine the first value and the last value. e.g. 1100011. here just twice a time value changes but there are four 1s and three 0s.
    thanks
    Did you focus on the word "sort"? 
    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?

  • Parsing a string to a boolean array

    I got to pase a string to a boolean array, this code works for me, but I don't like it. Here Is
    public static boolean[] NumeroToBoolArray( int Numero )
    //Here I got the number in Binary Format, then reverse it
    String temp = new StringBuffer(Integer.toBinaryString(Numero)).reverse().toString();
    //Now I create a boolean array of temp.length
    boolean[] data_bool = new boolean[temp.length()];
    for (int pp = 0; pp < data_bool.length ; pp++)
    //And now assign the value to data_bool
    data_bool[pp] = String.valueOf(Character.digit(temp.charAt(pp), 10)).equalsIgnoreCase("1");
    return data_bool;
    Any idea or replacement for this function?
    Thanks

    data_bool[pp] = String.valueOf(Character.digit(temp.charAt(pp),10)).equalsIgnoreCase("1");becomes
    data_bool[pp] = temp.charAt(pp) == '1';

  • Use boolean array to perform set operations

    I am currently taking a computer science class that uses Java as the language of choice. I have no prior experience with Java. We have a homework assignment in which we are supposed to use a boolean array to implement set operations. We have to create a method that inserts an integer into the array, another that deletes an integer element, and several others. I am confused as how to do this with integers, as it is a boolean array. The datr for this class is:
    private boolean base[];The constructor is:
    public largeset(int size){ }We then have to create a method that inserts an integer into the array:
    public void insert(int i){ }And one that deletes the element:
    public void delete(int i) { }I am unsure how to do this using a boolean array. If it were an integer array I would not have any trouble, but I get an error when trying to insert/delete an integer from the boolean array. Can anyone help point me in the right direction? I would prefer advice only, not the actual code, as this is a homework assignment, and I would like to create the code myself so I actually know what I am doing. Thanks.

    This is the assignment exactly as posted on the course website:
    In this homework, we will use a boolean array to implement various set operations. Please create a class called largeset that supports set operations of any number of elements. The data of this class is
    private boolean[] base;The constructor of the class is
    public largeset(int size);  // create a boolean array of size "size" and store it in "base"The methods of the class are:
    public void insert(int i);  // insert number i into the current set, where 0 <= i < base.length
    public void delete(int i);  // delete number i from the current set, where 0 <= i < base.length
    public boolean member(int i); // test if i is in the set
    public largeset union(largeset B); // return the union of two sets
    public largeset interset(largeset B); // return the intersection of two sets
    public largeset subtract(largeset B); // return the subtraction of two sets
    public largeset complement(); // return the complement of the current set
    public boolean subset(largeset B); // test if the current set is a subset of set B
    public int cardinality();  // return the number of elements in the current set
    public String toString();  // return a string which is a printing of the current setThen create another class called testset that uses the largeset class. At first, please create the following two sets:
    X = { 1, 3, 5, 7, ..., 999 };
    Y = { 9, 18, 27, 36, ..., 999 };
    Please perform the following tests:
    1. display the cardinalities of X and Y, respectively.
    2. display the content of substraction of Y by X.
    3. display the square root of the sum of all the elements of X (Math.sqrt(x) will return the square root of x in double type).
    4. For every pair of distinct elements x and y in Y, compute the sum of (Math.max(x, y) - Math.min(x, y)) (or equivalently, Math.abs(x - y)), and report this sum.

  • How to maintain data in a boolean array

    Hi
    i have booleans inside 1D array
    and i have a numerc control, and a text file so that the entered
    number going to be compared with the number in the text file
    if the numbers match, the boolean of that number goes on
    The question is that, when I enter another number the first
    boolean goes off how can I maintain the first
    boolean on .......
    in the Attachments it is shown i entered 5,then the fourth boolean goes ON
    but when i entered the second number "6", the last boolean goes ON
    and the first boolean which was ON goes OFF
    I wana keep both of them ON HOW ?
    Solved!
    Go to Solution.
    Attachments:
    Mr.Ismaill.vi ‏10 KB
    2.png ‏168 KB
    3.png ‏172 KB

    code
    Attachments:
    Mr.Ismaill2.vi ‏10 KB
    4.png ‏96 KB

  • Store boolean array as text file

    Hi there
    I'm having some trouble storinge a 25x25 2D array of booleans in a text file.
    First I make the 2D array a 1D array, and then I change it to a number, but here something already goes wrong, not the full number is stored, presumably because the array is this big?
    Any help will be much appreciated!
    Solved!
    Go to Solution.
    Attachments:
    Store 2D boolean array LV10.vi ‏17 KB

    You can also convert the 2D boolean array into 1D array of numbers and save to text file and then read back to load the original 2D Boolean array
    The best solution is the one you find it by yourself
    Attachments:
    2D Boolean to String.vi ‏16 KB

  • How to change the display order of Boolean Array

    Hi,
    I'm inputting an Hex number and want vi to display it as a Boolean array of indicators.
    The LSB appears to be on the top if the array goes up and down or, on the Left most while going right and left.
    As in Registers, the LSB is always on the Right most.
    How do I change the order of this display 180 degrees, so that the LSB is on the Right?
    Thanks
    Rafi

    Use the "reverse Array" from the array palette.
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Selecting specific data from an array controlled by a boolean array

    Hi!
    I am trying to select specific data from a string array. The string data should be auto indexed to a string array indicator, but I just want specific values to be placed in the new array.
    A boolean array controls when data should be auto indexed to the new string array. Every time a true appears in the for loop, the string data should be placed in the new string array, but I have a problem. I manage to pick the specific data to place in the new array, but i also get empty strings in the array when I am not supposed to write to the array. Instead of empty strings, I want my string data to be "compact". So when bool number 3 in the array is true, I want that string data to be in row 1, and not row 3.
    Can you help me sort this one out?
    Best regards
    Is my avatar the dog from the fraggle rock?
    Attachments:
    testprogram_forum.vi ‏10 KB
    Spørsmål lwforum.jpg ‏74 KB

    Here is a different version that also changes the size of the array for the indicator when the value is changed. You could do as much as you want here.
    Tim
    Johnson Controls
    Holland Michigan
    Attachments:
    testprogram_forum 2.vi ‏12 KB

Maybe you are looking for