Parsing a multi line txt file
garlo82
✭
I currently have a system that is reading offsets from a txt file stored in the robot home folder. Basically a csv file copied into a .txt file. The current way of reading it, is using the command below.
stPart:=ReadStr(datafileRd\Delim:="\09"\RemoveCR\DiscardHeaders);
Each line of txt consists of 60 Tab separated values which the current way of reading means its it reads all 60 values before it reads the next line.
What i am needing to do is after reading the first value on the line, if the value is not equal to the number i am looking for then drop down to the first value of the next line. i would keep dropping down the first value of each line till the value is = to number i am looking for, to which i can then use my existing code to read all the offsets of that line.
What would be the ReadStr command to line feed down as apposed to the above TAB delimeter.
This will reduce processing time of obtaining offsets from some very large txt files
stPart:=ReadStr(datafileRd\Delim:="\09"\RemoveCR\DiscardHeaders);
Each line of txt consists of 60 Tab separated values which the current way of reading means its it reads all 60 values before it reads the next line.
What i am needing to do is after reading the first value on the line, if the value is not equal to the number i am looking for then drop down to the first value of the next line. i would keep dropping down the first value of each line till the value is = to number i am looking for, to which i can then use my existing code to read all the offsets of that line.
What would be the ReadStr command to line feed down as apposed to the above TAB delimeter.
This will reduce processing time of obtaining offsets from some very large txt files
Tagged:
0
Comments
-
I don't know of any way to "fast forward" the reading of a file, sorry. What if you split each off into its own file?Lee Justice0
-
We have over 250 lines split over about ten files. This could be an option though. In reality it seems so simple and something easily done in the likes of VBA etc but cant seem to "search down the columns before reading across the line"0
-
Hello,
the function ReadStr provides the parameter "Line" which specifies which line in the file should be readReadStr (IODevice [\Delim] [\RemoveCR] [\DiscardHeaders] [\Time] [\Line])
Maybe this parameter can help to solve your problem.
0
Categories
- All Categories
- 5.5K RobotStudio
- 394 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 249 ScreenMaker
- 2.7K Robot Controller
- 309 IRC5
- 59 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 785 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 4 Job listings