Hi, i am having a file that consists of 2 columns, first is time/date stamp and 2nd is ON/OFF as text.
i want to determine the time-stamp when text is either ON or OFF.
i am not able to parse the data into 2 seperate columns and then read, can anyone help me out on this?
Attached is the example of the file.
Solved! Go to Solution.
youll want to open the text file read from text file and you can make use of the spreadsheet string to array. Then index your array and then feed your on/off string to a case structure and perform your read/not read there.
We usually ask to see code (which you provide by attaching your VI). This guards against "Do My Homework" requests, helps us understand the nature of the problem, gives us a better understanding of what you tried and what didn't work, allows us to "see the error for ourselves", enables us to "guess" if you are just getting started or are more experienced, etc.
So without code, here are some questions:
If you choose to answer these questions, I'd recommend also attaching any VIs you've written to attempt to solve this question. It will also help provide the answer to the question "What is LabVIEW 10.0?" (the last numbered version I have is 8.6 ...).
I'm sorry that I wasn't clear. I'm unable to execute your "picture", which is why I asked that you attach your VI (not a picture).
What do you see if you delete all of the code except the Read Text File function, and wire an indicator to its output? Do you get a single line?
Now add the next function and wire indicators to all of its outputs. [I'd do it, myself, but I don't have your code ...]. Read the Help documentation for the functions and play with them a bit until you understand them.
Read my other suggestions. Don't you see an easier way to get started (based on the data you showed)?
You should use the Spread Spreadsheet File (in the File palette) to read your file as a 2D array of strings. Then you can just do a search through the second colum to find the data you want.
I was going to throw out the solution, but bob and cruz are probably right that this is HW.
What is wrong with your above vi is that you are matching the pattern of OFF and ON, but you dont have an array, therefore your searching through your entire text file and on the first OFF you display the text in front of it. You need to first create an array from your spreadsheet string coming from the read text file. this can be done by either using a spreadsheet string to array function or as cruz stated the spreadsheet file. Im not sure of your desired final output, but from there you may want to feed it into a for loop and search each element for ON or OFF.
That should get you started.
Use Read SpreadSheet String Function, you will get output like this.