You can combine two tables using the join
function in MATLAB. Here's an example:
Assuming you have two tables with different number of rows:
main.m174 chars3 lines
You can combine them by specifying the key variables which are the ones that will be common between the two tables. Here we'll use the row numbers as the key variable:
main.m69 chars2 lines
This will create a new table T_combined
with all the columns from T1
and T2
. The results for the non-matching values will be NaN
.
Note that the join
function requires the Data Visualization Toolbox.
gistlibby LogSnag