I have a CSV file, I want to read this file and do some pre-calculations on each row to see for example that row is useful for me or not and if yes I save it to a new CSV file.
can someone give me an example?
in more details this is how my data looks like: (string,float,float) the numbers are coordinates.
ABC,51.9358183333333,4.183255
ABC,51.9353866666667,4.1841
ABC,51.9351716666667,4.184565
ABC,51.9343083333333,4.186425
ABC,51.9343083333333,4.186425
ABC,51.9340916666667,4.18688333333333
basically i want to save the rows that have for distances more than 50 or 50 in a new file.the string field should also be copied.
thanks
You could actually use
xlsreadto accomplish this. After first placing your sample data above in a file'input_file.csv', here is an example for how you can get the numeric values, text values, and the raw data in the file from the three outputs fromxlsread:You can then perform whatever processing you need to on the numeric data, then resave a subset of the rows of data to a new file using
xlswrite. Here’s an example: