LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Does 'Read Lines' option for 'Read from Text File' function work on PDA?

Hi Subhashini,

The first thing I want to mention is that everytime you use a While Loop, you should always include an option to stop it with a stop button, rather than just the status of the error wire.  If you do not do this, the VI will run continuously if it does not read an error, and you will have no way of stopping the VI.  You will then need to shut down and restart your PDA.

Also, I see that you are using the One-Button Dialog Box VI to display each string.  To do this properly, I would suggest using a For Loop rather than a While Loop, and set the N terminal of the For Loop to the number of lines to read.  This way, the VI will display a dialog box for each line, and then the VI will stop.  I've included an edited version of your example that uses this method. 

Please let me know if you have anymore questions, thanks!

0 Kudos
Message 11 of 19
(1,331 Views)

Hello Meghan,

    Thanks for ur response. I see that u have hard-coded the number of lines to read from the text file. In my application, i cannot hard-code the number of lines to read from text file because this will vary from file to file! Is there any function available in LabVIEW PDA to get the number of lines in a text file? If yes, then the approach u have suggested will work for me.

    Also, please note that the example i had posted did work on the desktop. So i feel that there is indeed a problem with 'Read lines' option checked on PDA.

Thanks & Regards,

Subhashini

 

0 Kudos
Message 12 of 19
(1,323 Views)

Hi Subhashini,

The attached screenshot of a block diagram shows how you can programmatically count the number of lines in a text file.  You can then wire this value into your the N terminal of your For Loop. 

0 Kudos
Message 13 of 19
(1,293 Views)

Hello Meghan,

    Thanks. Can u please give me the names of the array functions that u have used to 'Convert to an array and get number of rows'? Iam not able to fully make out which array functions u have used. If possible, please send the VI.

Thanks & Regards,

Subhashini

 

0 Kudos
Message 14 of 19
(1,271 Views)

Hi Subhashini,

Attached is the VI which will programmatically determine the number of lines in a text file.  Hope this helps, thanks!

0 Kudos
Message 15 of 19
(1,257 Views)
Hello Meghan,
 
    Thanks. The VI didn't work for me on desktop itself i.e. the "# of lines" is always zero. The only change that i did is that i removed the input to 'Read from Text file' so that it prompts me to select a file.
Thanks & Regards,
Subhashini
 
0 Kudos
Message 16 of 19
(1,251 Views)

Hi Subhashini,

Could you try running the VI with the input wired so that you are not prompted to select a file?  This might be the problem.  If you are still seeing errors, you might want to take a look at this KnowledgeBase.  Give this path format a try, and let me know if it works.

0 Kudos
Message 17 of 19
(1,223 Views)

Hello Meghan,

    I ran the VI on desktop with the input wired as u suggested, but still same problem - "# of Lines" is zero.

Thanks & Regards,

Subhashini

 

0 Kudos
Message 18 of 19
(1,190 Views)
Hi Subhashini,
 
If you transfer the text file attached below to your PDA, and read the # of lines with the VI I sent you earlier, do you still read zero?  If you try running this same VI on your PC rather than the PDA, do you still read zero?
0 Kudos
Message 19 of 19
(1,151 Views)