MATLAB: Concatenating and comparing two datsets

MATLAB

Hi,
I have two datasets in excel of cell arrays which have columns containing charaters and numbers. The first dataset has 300 rows and 10 cols, and the second dataset 250 rows and 9 columns.
Column 10th and 9th of dataset1 and datset 2 are numbers , while all other columns are characters.
  1. for the first dataset I want to concatenate the first 8 columns.
  2. For the second data sets I want to do the same as step.1
  3. If the concatenated description of 1st dataset is same as second then I want to add 10th column of first data to the 9th colmn of send datasets.
I am new here but is there a method in matlab to do is?. I was doing this in excel in the past and it has been time-consuming and I was making erros doing this manually.
Any help greatly appreciated.
Thanks.
SSR

Best Answer

Assuming that the 9th column of both data sets is the same, I think you can do this just with an innerjoin
tbl1 = readtable('data1.xlsx')
tbl2 = readtable('data2.xlsx')
% join them to make third table which adds additional column to
% second table where character columns match
tbl3 = innerjoin(tbl1,tbl2)
There are probably some use cases that Guillaume is covering in his answer that may be important, but maybe this simple approach works for what you are doing.