| | 68 | function pts2csv(fileName) |
| | 69 | if fileName:sub(-4, -1):lower()==".pts" then |
| | 70 | -- Strip the .pts suffix, if present. |
| | 71 | fileName=fileName:sub(1, -5); |
| | 72 | end |
| | 73 | |
| | 74 | -- Load and run the point file in order to obtain the Points table. |
| | 75 | dofile(fileName .. ".pts"); |
| | 76 | |
| | 77 | -- Write all points into a new csv file. |
| | 78 | local csvFile=assert(io.open(fileName .. ".csv", "wt")); |
| | 79 | |
| | 80 | csvFile:write('"time","x","y","z","heading","info"\n'); |
| | 81 | for i=1, #Points do |
| | 82 | csvFile:write("\"", table.concat(Points[i], "\",\""), "\"\n"); |
| | 83 | end |
| | 84 | |
| | 85 | csvFile:close(); |
| | 86 | end |
| | 87 | |
| | 88 | |