2 views (last 30 days)

I have a large .csv file (~7GB) where the first column is filled with datetimes, and the remaining columns filled with data corresponding to that datetime.

e.g.:

20191025241533, 65.2, 35.2, 75.4

20200122061522, 32.2, 74.5, 61.3

20190411075120, 54.1, 87.0, 22.1

I then have a second smaller .csv which contains a list of datetimes which are of interest to me.

e.g.

20191025241533

20191025241533

I would like to subset the first large .csv based on the datetime values in the second, so I would only keep rows with datetimes present in the second .csv.

Secondly, I would like to use the datetime values in the second smaller .csv to extract files (where the filename is datetime) from a larger folder of files into a separate folder which contains only those files that have the same filename (datetime) as those recorded in the smaller .csv.

Thanks for your help!

Opportunities for recent engineering grads.

Apply TodayFind the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
## 11 Comments

## Direct link to this comment

https://ch.mathworks.com/matlabcentral/answers/519456-subset-variable-data-in-one-csv-based-on-values-from-same-variable-in-a-second-csv#comment_831887

⋮## Direct link to this comment

https://ch.mathworks.com/matlabcentral/answers/519456-subset-variable-data-in-one-csv-based-on-values-from-same-variable-in-a-second-csv#comment_831887

## Direct link to this comment

https://ch.mathworks.com/matlabcentral/answers/519456-subset-variable-data-in-one-csv-based-on-values-from-same-variable-in-a-second-csv#comment_836395

⋮## Direct link to this comment

https://ch.mathworks.com/matlabcentral/answers/519456-subset-variable-data-in-one-csv-based-on-values-from-same-variable-in-a-second-csv#comment_836395

## Direct link to this comment

https://ch.mathworks.com/matlabcentral/answers/519456-subset-variable-data-in-one-csv-based-on-values-from-same-variable-in-a-second-csv#comment_836691

⋮## Direct link to this comment

https://ch.mathworks.com/matlabcentral/answers/519456-subset-variable-data-in-one-csv-based-on-values-from-same-variable-in-a-second-csv#comment_836691

## Direct link to this comment

https://ch.mathworks.com/matlabcentral/answers/519456-subset-variable-data-in-one-csv-based-on-values-from-same-variable-in-a-second-csv#comment_838424

⋮## Direct link to this comment

https://ch.mathworks.com/matlabcentral/answers/519456-subset-variable-data-in-one-csv-based-on-values-from-same-variable-in-a-second-csv#comment_838424

## Direct link to this comment

https://ch.mathworks.com/matlabcentral/answers/519456-subset-variable-data-in-one-csv-based-on-values-from-same-variable-in-a-second-csv#comment_838779

⋮## Direct link to this comment

https://ch.mathworks.com/matlabcentral/answers/519456-subset-variable-data-in-one-csv-based-on-values-from-same-variable-in-a-second-csv#comment_838779

## Direct link to this comment

https://ch.mathworks.com/matlabcentral/answers/519456-subset-variable-data-in-one-csv-based-on-values-from-same-variable-in-a-second-csv#comment_838823

⋮## Direct link to this comment

https://ch.mathworks.com/matlabcentral/answers/519456-subset-variable-data-in-one-csv-based-on-values-from-same-variable-in-a-second-csv#comment_838823

## Direct link to this comment

https://ch.mathworks.com/matlabcentral/answers/519456-subset-variable-data-in-one-csv-based-on-values-from-same-variable-in-a-second-csv#comment_838858

⋮## Direct link to this comment

https://ch.mathworks.com/matlabcentral/answers/519456-subset-variable-data-in-one-csv-based-on-values-from-same-variable-in-a-second-csv#comment_838858

## Direct link to this comment

https://ch.mathworks.com/matlabcentral/answers/519456-subset-variable-data-in-one-csv-based-on-values-from-same-variable-in-a-second-csv#comment_841843

⋮## Direct link to this comment

https://ch.mathworks.com/matlabcentral/answers/519456-subset-variable-data-in-one-csv-based-on-values-from-same-variable-in-a-second-csv#comment_841843

## Direct link to this comment

https://ch.mathworks.com/matlabcentral/answers/519456-subset-variable-data-in-one-csv-based-on-values-from-same-variable-in-a-second-csv#comment_842053

⋮## Direct link to this comment

https://ch.mathworks.com/matlabcentral/answers/519456-subset-variable-data-in-one-csv-based-on-values-from-same-variable-in-a-second-csv#comment_842053

## Direct link to this comment

https://ch.mathworks.com/matlabcentral/answers/519456-subset-variable-data-in-one-csv-based-on-values-from-same-variable-in-a-second-csv#comment_842060

⋮## Direct link to this comment

https://ch.mathworks.com/matlabcentral/answers/519456-subset-variable-data-in-one-csv-based-on-values-from-same-variable-in-a-second-csv#comment_842060

## Direct link to this comment

https://ch.mathworks.com/matlabcentral/answers/519456-subset-variable-data-in-one-csv-based-on-values-from-same-variable-in-a-second-csv#comment_846811

⋮## Direct link to this comment

https://ch.mathworks.com/matlabcentral/answers/519456-subset-variable-data-in-one-csv-based-on-values-from-same-variable-in-a-second-csv#comment_846811

Sign in to comment.