Only keep rows with the same names from multiple excel files

1 view (last 30 days)
I have multiple excel files with data for different roads across several years. I would like to create a file that combines all the data for the different roads across the years but only for the roads that appear in all years. I have attached two files as an example of the data I am working with. The important column is the "ROAD_NAME" column. For example, lets say Smith Road appears in the 2013 file, but not the 2014 file, I want to delete the rows that contain Smith Road. Lets also say that John Street appears in both the 2013 and 2014 files, so I want to keep all the rows that contain John Street.
I'm pretty new to matlab so any advice would be appreciated

Answers (1)

KSSV
KSSV on 5 Jul 2019
  1. Load the files using either xlsread or readtable.
  2. YOu can get the common data from both the files using either ismember or intersect.

Categories

Find more on Tables 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!