outerjoin
outerjoin(t1,t2,'keys',n) joins between two tables. If there is more than one common column name, n specifies the position of the column that will be taken as key variable.
The first table (t1) defines the rows to match.
The first table (t1) defines the rows to match.
Examples
>> a = table({'a';'b'}, [32; 43])# Col1 Col2 a 32 b 43 >> b = table({'a'}, 5, 'VariableNames', {'Col1'; 'Col3'})# Col1 Col3 a 5 >> outerjoin(a,b)#% if there is just one common variable name, it is not needed to specify the key
Col1 Col2 Col3 a 32 5 b 43 NaN >> outerjoin(b,a)#% the first input defines the rows to match
Col1 Col3 Col2 a 5 32
>> a = table({'a';'b';'c'},[1;2;3])# Col1 Col2 a 1 b 2 c 3 >> b = table({'a';'c'},[pi;pi/2])# Col1 Col2 a 3.14159 c 1.5708 >> outerjoin(a,b,'keys',1)#% the key variable is the first column (Col1)
Col1 Col2 Col2_2 a 1 3.14159 b 2 NaN c 3 1.5708