splitting a .txt or .xlsx into separate data sets
Show older comments
I have a set of data output from Polyworks that's essentiall miltiple line profiles and I'm looking for a way to automated separating them to save time as I run through multiple sets of data
the data sets are put out in this format as a .txt
# dataset 1 - 0
x1,y1,z1
x2,y2,z2
x3,y2,z2
# dataset 1 - 1
x4,y4,z4
x5,y5,z5
# dataset 1 - 2
x6,y6,z6
# dataset 2 - 0
x1,y1,z1
x2,y2,z2
in this case there's 2 data sets, however the data sets are split into subsets, eq 1 - 0, 1 - 1, 1 - 2
x y and z are positional values
each set starts with a '- 0' and the other nnumbers I just want the rows deleting so the file would look more like this:
# dataset 1 - 0
x1,y1,z1
x2,y2,z2
x3,y2,z2
x4,y4,z4
x5,y5,z5
x6,y6,z6
# dataset 2 - 0
x1,y1,z1
x2,y2,z2
following that I'd like the different datasets to be split into separate files so I can process them all individually and compare them
the amount of "sub" sets for each dataset is incosistent but they always start at - 0 and for addition reference the dataset names are actually more like "# AMSA4 combined - Cloud - clean.txt -meas- (13) - 0" for example
I'm sure there's a simple solution to this but I've not been able to find anything helpful from searching
Accepted Answer
More Answers (0)
Categories
Find more on Text Analytics Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!