Hi David,
I'm not sure whether I understand your problem correctly. Based on my understanding, outerjoin should help you with your use case. outerjoin will return the union of the unique combinations of the three keys from the input tables. Therefore, no matter whether the key combination of the right table exists in the left table or not, the output will contain all combinations with filling missing value for the rows that the combination was not found.
outcome1 = ["11_right"; "12_right"];
range1 = ["80ms,110ms";"110ms,140ms"];
ROI1 = ["Red"; "Yellow"];
Var1 = [1.1;1.2];
t1 = table(outcome1,range1,ROI1,Var1,'VariableNames',{'Outcome', 'Range', 'ROI', 'Var1'});
outcome2 = ["11_right"; "12_right"];
range2 = ["140ms,195ms";"110ms,140ms"];
ROI2 = ["Red"; "Yellow"];
Var2 = [2.1;2.2];
t2 = table(outcome2,range2,ROI2,Var2,'VariableNames',{'Outcome', 'Range', 'ROI', 'Var1'});
outcome3 = ["11_left"; "12_left"];
range3 = ["110ms,140ms";"140ms,195ms"];
ROI3 = ["Blue"; "Green"];
Var3 = [3.1;3.2];
t3 = table(outcome3,range3,ROI3,Var3,'VariableNames',{'Outcome', 'Range', 'ROI', 'Var1'});
>> t1
t1 =
2×4 table
Outcome Range ROI Var1
__________ _____________ ________ ____
"11_right" "80ms,110ms" "Red" 1.1
"12_right" "110ms,140ms" "Yellow" 1.2
>> t2
t2 =
2×4 table
Outcome Range ROI Var1
__________ _____________ ________ ____
"11_right" "140ms,195ms" "Red" 2.1
"12_right" "110ms,140ms" "Yellow" 2.2
>> t3
t3 =
2×4 table
Outcome Range ROI Var1
_________ _____________ _______ ____
"11_left" "110ms,140ms" "Blue" 3.1
"12_left" "140ms,195ms" "Green" 3.2
>> t_1 = outerjoin(t1,t2,'Keys',{'Outcome', 'Range', 'ROI'},'MergeKeys',true)
t_1 =
3×5 table
Outcome Range ROI Var1_t1 Var1_t2
__________ _____________ ________ _______ _______
"11_right" "140ms,195ms" "Red" NaN 2.1
"11_right" "80ms,110ms" "Red" 1.1 NaN
"12_right" "110ms,140ms" "Yellow" 1.2 2.2
>> t_2 = outerjoin(t_1,t3,'Keys',{'Outcome', 'Range', 'ROI'},'MergeKeys',true)
t_2 =
5×6 table
Outcome Range ROI Var1_t1 Var1_t2 Var1
__________ _____________ ________ _______ _______ ____
"11_left" "110ms,140ms" "Blue" NaN NaN 3.1
"11_right" "140ms,195ms" "Red" NaN 2.1 NaN
"11_right" "80ms,110ms" "Red" 1.1 NaN NaN
"12_left" "140ms,195ms" "Green" NaN NaN 3.2
"12_right" "110ms,140ms" "Yellow" 1.2 2.2 NaN