ASC file to 2D boolean array

Hey guys,
I was wondering if there is a method of uploading an *.ASC or *.DAT file to convert into a 2-D boolean array.
For example, I would create an .asc or .dat file composed of strings using MATLAB to generate
1 1 0 1 1 0 1 1
0 1 0 0 1 0 0 1
1 0 0 1 0 0 1 0
and it would convert the string to a 2-D boolean array of
T T F T T F T T
F T F F T F F T
T F F T F F T F
so that I can ultimately use it to create a modified Digital waveform graph like this:
The purpose is because I will be using sample rates of 0.1 second intervals that spans to 2-5 minutes.
So to sum it up:
1. upload a *.ASC or *.DAT file with a 2-D array strings
2. convert the file to create a 2-D boolean array for use to create the digital waveform
Any help will be appreciated. I know it isn't much but I've uploaded the 2-D array to waveform *.VI for testing purposes.
Solved!
Go to Solution.
Attachments:
boolean_array.vi ‏14 KB

sdkpark wrote:
However, when I tried that first, it doesn't know how to separate each column of the *.asc file
1 0 0 1 0 0
0 1 1 0 1 1
turns out just to read the first column
Please attach your VI instead of a meaningless picture.
Read from spreadsheet file will read all 2D data if used correctly. The defined delimiter is separating items, and linefeed separating rows. For example if you don't wire the delimiter, it will assume "tab" and only one value will get read per line if it is actually a space character. Try a delimiter of "space".
LabVIEW Champion . Do more with less code and in less time .

Similar Messages

  • 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

  • Reading in a binary file and displaying an array correctly

    I am teaching myself Labview 7.1 and what I am trying to do is read in a text file of binary digits 10011001, 11011101 etc and then output these to a series of leds (boolean array) as well as to another array to display what was read in. I can get this to happen when I format the text file as 1,0,0,1,1,0,0,1 but then the array is 1 column by 8 rows (is this a 1by8 array) I want to read this data in as 10011001 displayed on 1 row and then the next row of the array to be 11011101, it displays 11111111 if I go above 3 digits, I know this is just a problem with binary versus decimal numbers, how can I format the input file so it is read in as 8-bit binary?
    Thank you in advance,
    Dan Ziehm

    Read the text file as string, then pass it through "spreadsheet string to array" with "," as delimiter, %b as format and an U8 array as type. I made a quick demo, see attached code image.
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    binaries.gif ‏45 KB

  • NSArray for boolean array, define size...

    Hi!
    I have a Class that I'm trying to create...
    The class have a boolean array that I define the size when the class initialize...
    I put an NSArray in the .h file and I try to define the size of the array on initialisation based on a formula with the parameters for the init method.
    I'm so new to Objective-C, I try to do that the same way I did it in C#..:S
    What should I do?
    Where Can I find information about class definition and sample with int or bool array?
    Thanks!
    Fred

    ShrimpBoyTheQuick wrote:
    Hi!
    I think I understand something here..
    In C, I cannot put an unsized array in the .H file and set the size in the init method in the .m file...
    Kinda true, but you can dynamically allocate memory at runtime to hold an array of whatever size you want.
    What I can do is....
    Define a pointer and a size in the .h file...
    Create an array of the good size in the .m file and put the memory address of the array in the pointer and use this array with the pointer and the size value...
    I don't think the code you posted will work right. I believe the "roomArray" that you're creating inside "initWithWidth" is a local variable that will go away once you exit the "initWithWidth" method. So even though you've stored a pointer to it in "arrayPtr" ultimately you'll be pointing at garbage once that memory gets reclaimed and reused by the runtime system.
    What's my problem after this is how do I tell the object to not used the memory of this array after the method is finished?
    Take a look at this discussion of dynamically allocated arrays in C. Basically you'll use malloc() to allocate memory for your array and then later use free() when you no longer need the array. And since you're dealing with width and height you're needing a two dimensional array which becomes somewhat messier.
    Steve

  • 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 can I add a True value to position (0,1) in a 2*2 boolean array?

    Hi everyone, let's say I have a 2*2 boolean array (Indicator), how can I let the element in position (0,1) for example be true??
    Thanks.
    T. A.
    Solved!
    Go to Solution.

    Hi T.A.,
    1) ReplaceArraySubset with indices 0&1 and element=TRUE.
    2) OR Array with an array constant of [(F,T),(F,F)]
    Message Edited by GerdW on 11-23-2009 03:22 PM
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • I write digital port by 'DAQmx Configure Logging.vi​' and receive TDMS file with 8 boolean channels. How can I write to 1 integer channel?

    Hello!
    I want to write 1 digital port from PXI-6536 with streaming to TDMS file.
    I'm writing by 'DAQmx Configure Logging.vi' and become TDMS file with 8 boolean channels.
    How can I write to 1integer channel?
    Attachments:
    1.JPG ‏27 KB

    Hey Atrina,
    The actual data stored on disk is just the raw data (that is, a byte per sample in your case).  It's really just a matter of how that data is being represented in LabVIEW whenever you read back the TDMS file.
    I'm not sure if there is a better way to do this, but here is a way to accomplish what you're wanting:
    Read back the TDMS file as a digital waveform.  Then there's a conversion function in LabVIEW called DWDT Digital to Binary.  This function will convert that set of digital channels into the "port format" that you're wanting.  I've attached an example of what I mean.
    Note: When looking at this VI, there are a few things that the downgrade process did to the VI that I would not recommend for these TDMS files.  It added a 1.0 constant on the TDMS Open function, and it set "disable buffering" on the TDMS Open function to false; you can get rid of both of those constants.
    Message Edited by AndrewMc on 01-27-2010 11:21 AM
    Thanks,
    Andy McRorie
    NI R&D
    Attachments:
    digitalconvert.vi ‏13 KB

  • Reading a CSV file and producing an array of objects

    Hi everybody,
    I am writing an application which will read a cvs file and produce an array of objects.
    Can any body help me to solve this problem?
    Thanks
    Finny

    Hello,
    Have you tried this link?
    http://ostermiller.org/utils/CSV.html

  • How to copy data in text file into two-dimensional arrays?

    Greeting. Can somebody teach me how to copy the input file into two-dimensional arrays? I'm stuck in making a matrix with number ROWS and COLUMNS according to the data in "input.txt"
    import java.io.*;
    import java.util.*;
    public class array
        public static void main (String[] args) throws FileNotFoundException
        { Scanner sc = new Scanner (new FileReader("input.txt"));
            PrintWriter outfile = new PrintWriter("output.txt");
        int[][]matrix = new int[ROWS][COLUMNS];
    }my input.txt :
    a,b,c
    2,2,1
    1,1,1
    2,2,1
    3,3,1
    4,4,1
    5,5,1
    1,6,2
    2,7,2
    3,8,2
    4,9,2
    5,10,2

    import java.io.*;
    import java.util.*;
    public class array {
        public static void main(String[] args) throws IOException {
            FileInputStream in = null;
            FileOutputStream out = null;
    try {
        in = new FileInputStream("input.txt");
        BufferedReader reader = new BufferedReader(new InputStreamReader(in));
        String line = null;
        while ((line = reader.readLine()) != null) {
            String split[]=line.split(",");
    catch (IOException x) {
        System.err.println(x);
    } finally {
        if (in != null) in.close();
    }}}What after this?

  • Reading from a text file in to an array, help please

    I have the following
    public class date extends Loans{
    public int dd;
    public int mm;
    public int yyyy;
    public String toString() {
    return String.format( "%d,%d,%d", mm, dd, yyyy );
    public class Loans extends Borrowing {
    public String name;
    public String book;
    public date issue;
    public char type;
    public String toString(){
    return String.format( "%s, %s, %s, %s", name, book, issue, type );
    import java.util.Scanner;
    import java.io.*;
    public class Borrowing extends BorrowingList {
    private Loans[] Loaned = new Loans[20];
    if i want to read in from a text file in to that array how do i do it?

    sorry to keep bothering you and thanks loads for your help but now I am getting the following error mesage
    C:\Documents and Settings\MrW\Menu.java:43: cannot find symbol
    symbol : class IOException
    location: class Menu
    }catch(IOException e){
    Note: C:\Documents and Settings\MrW\Borrowing.java uses unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    1 error
    BUILD FAILED (total time: 0 seconds)
    for this line
    }catch(IOException e){                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

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

  • Programmat​ically Cycle through Boolean Array

    I'm using an Agilent 34970 with a 34901A switch module. It has 16 switches going to two commons. The end function is to switch through all the sources to read resistance and voltage.
    The driver and sample vi from the NI idnet were used as a base for my vi.
    The sample vi uses a user-controlled 2-d boolean array (false = open). I want to be able to programmatically cycle through all the switches, but I don't know how to tell the dimensions of array I have.
    I would like to go through every element of the 2nd raw for each element in the 1st row. If I could programmatically ignore elements #9, 10, 19, and 20, that would be helpful too.
    Thanks for any help!
    Attachments:
    Agilent 34970 Advanced Scan-2U test-1.vi ‏31 KB
    Agilent 34970 Switch-2U test.vi ‏23 KB

    CelerityEDS wrote:
    Is there a way to determine what's in the vi front panel right now? I cannot determine if it's 2x10 or 10x2... There are no properties of the 2-d array that plainly tell me.
    There is "array size" which tells you the actual size of the 2D array.
    There are properties that tell you how many rows and columns are visible in the front panel array container.
    There are also properties that tell which element is currently scrolled to the top left corner.
    The size and index position of the front panel array control or indicator is not related to the actual array size. You can show only 2x2 elements of a 1000x1000 array or vice versa. if the container is too big, the extra elements are greyed. 
    LabVIEW Champion . Do more with less code and in less time .

  • 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';

  • How to address an cell in a boolean array

    Hello
    I am intersted in addessing a certain cell in a boolean array.
    Suppose I have a boolean array called bArr which is of length 10 and contains  values  of { T,T,F,F,F,F,T,F,T,F }
    and I want to send to an "AND" gate bArr[0] together with  "TRUE" constant.
    How do I address the cell bArr[0] or any other cell in bArr ???
    Lavi
    P.S: I am using LabVIEW 8.0 

    Hi Lavi,
    You could ve easily given me 5 stars atleast !
    - Partha
    LabVIEW - Wires that catch bugs!

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

Maybe you are looking for

  • Creation of new element in Model Node

    Dear All, I am facing one problem, I have two  model node. I want to copy one model node to other model node.while copying its giving error saying the you can bind the element, coz target node doesn't have valid parent. Pl don't suggest me work on Va

  • Converting shaders from other programs?

    I'm just getting started with Pixel bender, but I've played around with fairly simplified GLSL Shaders in Max/MSP and Quartz Composer before. I'm trying to convert this one shader for use in after effects, but I'm a bit stuck on converting some of th

  • Open Photoshop 3 files and convert to TIFF or JPEG --- on the cheap!

    Hello, I have about a hundred large scans in PS3 format on DVD. I never use PS or other pro photo SW; only iPhoto. My last PS is v7. I run the latest Snow Leopard on my new MBP 17 iCore7. All I want is to recover these files and convert them to the h

  • Report in 902

    I need help with making a report in Portal 9.0.2, using the tables below. My_table wwsec_person$ Employee_id <----> id date first_name etc last_name In Portal 3.0.9 this worked fine. select date, etc, first_name from my_table, wwsec_person$ where emp

  • [SOLVED] Missing libsmime3.so

    Hi, everyone. I'm trying to run a native application which relies on dynamic runtime libraries that are missing in my system, one of those is libsmime3.so. I've googled it and found that the missing library is either libsmime3 or libnss3, none of whi