+ Reply to Thread
Results 1 to 5 of 5

How to scan/ read a text file, pick up only lines you wanted.

  1. #1
    Junior Member
    Join Date
    Nov 2009
    Posts
    0

    Default How to scan/ read a text file, pick up only lines you wanted.

    I'm new to Labview, I trying to wire a VI which can read a text file
    example below:
    Example: My Text File:
    1 abcd
    2 efgh
    8 aaaa
    1 uuuu

    and pick out only any line which start with number 1 (i.e 1 abcd)
    then output these 2 lines out to a a new text file?

    Thanks,
    Palmtree

  2. #2
    Junior Member
    Join Date
    Nov 2009
    Posts
    0

    Default Re : How to scan/ read a text file, pick up only lines you wanted.

    Hi,
    here you have a VI that read from a .txt files and extract the line beginning by a "1"
     
     


    read_from_file.vi:
    http://forums.ni.com/attachments/ni/...d_from_file.vi

  3. #3
    Junior Member
    Join Date
    Nov 2009
    Posts
    0

    Default Re: Re : How to scan/ read a text file, pick up only lines youwanted.

    On Feb 2, 1:40 am, MarcC <x...@no.email> wrote:
    > Hi,
    > here you have a VI that read from a .txt files and extract the line beginning by a "1"
    > &nbsp;
    > &nbsp;
    >
    > read_from_file.vi:http://forums.ni.com/attachments/ni/...d_from_file.vi


    Hi MarcC,
    Thanks very much for your help. I got it.

    Regards,
    palmtree.

  4. #4
    Junior Member
    Join Date
    Nov 2009
    Posts
    0

    Default Re: Re : How to scan/ read a text file, pick up only lines youwanted.

    On Feb 2, 1:40 am, MarcC <x...@no.email> wrote:
    > Hi,
    > here you have a VI that read from a .txt files and extract the line beginning by a "1"
    > &nbsp;
    > &nbsp;
    >
    > read_from_file.vi:http://forums.ni.com/attachments/ni/...d_from_file.vi


    Thanks for the help, I got it but if I go a little further, I'm still
    stuck. Suppose my text file now is:
    Example: My Text File:
    1 abcd stringstring
    2 efgh stringstring
    8 aaaa stringstring
    1 uuuu stringstring
    and I want to extract lines start with number 1 only (i.e: 1 abcd
    stringstring and
    1 uuuu stringstring), how do I do it? I'd been Edit Scan String but
    can get a good result.

    Thanks ahead.
    palmtree

  5. #5
    Junior Member
    Join Date
    Nov 2009
    Posts
    0

    Default Re : Re: Re : How to scan/ read a text file, pick up only lines youwanted.

    Hi, How do you creat your text files? Depending on the programm, there is added characters in the beginning and at the and of the file. So here you will find a VI to creat "raw" text files. To debug your VIs, use the probs and breakpoints, so you can solve the problem by your self or give an more accurate description of it.There is also the VI that read a integer and two strings&nbsp; (%d %s %s)


    creat text file.vi:
    http://forums.ni.com/attachments/ni/170/299652/1/creat text file.vi


    read_from_file.vi:
    http://forums.ni.com/attachments/ni/...d_from_file.vi

+ Reply to Thread