LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading from Xl or Notepad skips certain numbers

The problem that I am having is that when reading numbers from excel or Notepad certain numbers will be skipped, but only on the first row. Reading from the second row works great. I have tried all kinds of things but still on the first row certain numbers like to be skipped like 0's or numbers with 0's in them, I have noticed other numbers being skipped also.

Any ideas? Attached is the VI, the Xl, and Notepad files.

Thanks Much,

~CalTech
Download All
0 Kudos
Message 1 of 4
(2,635 Views)
The Read From Spreadsheet fucntion is working just fine. You can verify this yourself. Right click on it and select SubVI Setup. Then select Show Front Panel when called, Close Afterwards if originally closed, Suspend when called. Then when you run the program, the Read From spreadsheet will pause before running. Run it and before returning (by clicking the ^ button on the toolbar, scroll through the array returned. You will see all values. Your problem has to be in the indexing of the results returned. I'm not sure what you're attempting to do but there might be a problem with using the Default Value when a wire exits the event structure.
Message 2 of 4
(2,635 Views)
For both instances of "read from spreadheet file" remove the wire going to the terminal labeled "start of read offset (chars)" this input is improperly used. (Basically, once you read three numbers from line 1, the first number is skipped and all remaining numbers drop by one index position).

Overall, here are a few tips to make your code a bit simpler.

(1) Place the two index shift registers through the even structure and add a [+1} to the correct trace in each event.

(2) Read the spreadsheet file outside the while loop once and feed the resulting 2D array to the event structure. Then simply index into it depending on the event and index position. (You are reading the entire spreadheed again and again, just to throw everything away except one num
ber).

(3) Get rid of the sequence structures and property writes (reset to default). Simply set the mechanical action of buttons labeled "Deck A" and "Deck B" to "latch when released". (You probably choose the absolute worst method to simply set a boolean control to "false". In order of preference: (1) Latch action, (2) write local variable, (3 and 4 maybe tie?) write value property or reset to default property.
Message 3 of 4
(2,635 Views)
Also, to avoid confusion, please don't use the .xls file extensions for plain tab-seperated ASCII files. Excel is a proprietary microsoft format containing complex headers. "Read from spreadsheet" file cannot read genuine excel files. Just changing an extension does not convert a file to excel format. If you would like to have excel open your plain files by default, give them your own unique extension and associate it with excel.
0 Kudos
Message 4 of 4
(2,635 Views)