LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Boolean read spreadsheet elements from different lines

What I would like to do is read a file from Line 1 in the Excel spreadsheet if boolean 1
is pressed and read from line 2 in the same spreadsheet if boolean 2 is pressed. I would
like to do this in sequential order meaning say boolean one is pressed the rist time, I would
like to then read the first element from line 1 in the spreadsheet then if A is pressed again
to then read the second element from the spreadsheet. But then say boolean 2 is pressed
for the first time I would like to then read the first value from the second line of the spreadhseet.
Then if Boolean 2 is pressed again to read the second value from the second line of the
spreadsheet. If then I decide to press Boolean 1 again, I
would like to then read the third
value from the first line of the spread sheet and so on. At the end this should reset so I
can do it all gain.

Thanks much,

Brian
0 Kudos
Message 1 of 5
(3,236 Views)
Hi. This is solved by using a case structure inside a while loop and shift registers to keep track of how many times a button has been pressed. Instead of writing a very long written description, I will let you look at the code, and let me know if you have questions. If you cannot open the VI, which is in version 7.0, you can look at the image. In case 1 of the case structure, you would increment by 1 the second wire going to the shift register (instead of the first one as in case 0 shown).
Message 2 of 5
(3,236 Views)
I don't have LabVIEW 7.0 so I reconstructed it from the pictures you sent, (thanks by the way), unfortunatly though it is not reading from my Spreadsheet and I am hardpressed to find out why. Could you tell me what I am doing wrong? I also attached a spreadsheet file. Should this program be able to read numbers as well as letters from the spreadsheet file? I didn't have any luck with just numbers so I added a few letters in my spreadsheet and it still won't work.

Thanks,

CalTech.
Download All
0 Kudos
Message 3 of 5
(3,236 Views)
Nevermind on that last comment, I was looking through online stuff and I see that spreadsheets that the program reads are not that of excel and that I had to paist the stuff into notepad. However, is there other files that work as well or better>

Thanks,

Brian
0 Kudos
Message 4 of 5
(3,235 Views)
Hello.
I am glad you have got it somewhat working now. Indeed, the "spreadsheet" files need to be text files. You can save it as a text file from excel, without the need to copy and paste. Just select save as, Save as type: text(tab delimited).

Just a comment on the code that you sent: for it to work correctly, the part where you build the array and have the search 1-d array function should be inside the while loop, and the case structure should have a default case different from 0 in which you just "wire through" the output of the third shift register. I hope this is not too confusing.
0 Kudos
Message 5 of 5
(3,236 Views)