%% Inner-Join Operation of Tables with One Variable in Common
% Create a table, Tleft.

Tleft = table([5;12;23;2;6],...
        {'cereal';'pizza';'salmon';'cookies';'pizza'},...
        'VariableNames',{'Age','FavoriteFood'})

%
% Create a table, Tright, with one variable in common with Tleft.

Tright = table({'cereal';'cookies';'pizza';'salmon';'cake'},...
         [110;160;140;367;243],...
         {'A-';'D';'B';'B';'C-'},...
         'VariableNames',{'FavoriteFood','Calories','NutritionGrade'})

%
% Use the innerjoin function to create a new table, T, with data from tables Tleft and Tright.

T = innerjoin(Tleft,Tright)

% Table T is sorted by the key variable, FavoriteFood.
% Copyright 2012 The MathWorks, Inc.