LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Use text file as input for a NI-USB

Hi i want to read a file to give as an input voltage for a ni-usb.i got a code where i choose between a constant value and a text.The constant value is ok but the text doesnt work when i try to measure with the multimeter.

Download All
0 Kudos
Message 1 of 6
(2,636 Views)

diro,

 

Could you provide an example text file that you're trying to use?

dK
0 Kudos
Message 2 of 6
(2,593 Views)
0 Kudos
Message 3 of 6
(2,580 Views)

In your text file VI, you are using the string "\n" as the end of file constant, but since it is in normal mode, it is a literal backslash and "n".  You want to make that constant have \codes display.  then edit it so it shows "\n" which at that point will be a linefeed character.

 

You may have more work to do with that because a typical  Spreadsheet string to Array is for 2-D arrays, not 1-D arrays, and the rest of the code makes it hard to determine if you are indexing out the value you want.

0 Kudos
Message 4 of 6
(2,553 Views)

I made some changes.Also I did make that constant have \codes display. I also tried to make the spreadsheet string to array a 1d array by using Initialize array.At path_1.vi i get to show only the first value of the text.And an the 1ni.vi it doesnt even appear the 1st value

Download All
0 Kudos
Message 5 of 6
(2,530 Views)

Here are cleaned up versions of 2 of your VI's.  It got rid of some Rube Goldberg constructs as well.

 

When working with indices, they should be I32 integers and not Doubles.

Don't call a numeric indicator "String" when it is a numeric.

I changed the handling of your file so that it treats like incoming string data as a 2-D string (which is what spreadsheet string to array creates) and then picks out the only column that exists in that array.

Download All
Message 6 of 6
(2,503 Views)