MATLAB: Reorder table columns names

table

Hi,
I have two tables
The order of the columns in the 1st table is:
Date, temp, humidity, pressure, precip, depth
The order of the columns in the 2nd table is:
Date, pressure, temp, humdity, precip, depth
How can I change the order of the 2nd table column names to match the order of the 1st table column names?
Thank you.

Best Answer

Hint:
[~, newOrder] = ismember(T1.Properties.VariableNames,T2.Properties.VariableNames);
Or, as Steven Lord points out in the comments below, you can use the VariableNames of Table 1.