Assuming it's this timealign
Here's a way to do it using rules, the input is slightly altered and now takes {t1, u1}, {t2, u2}, ...
as input instead of t1, t2, u1, u2
.
Null
is used instead of NaN, the time indices don't have to be ordered but will be in the result:
timeAlign[pairs_List] :=
With[{
t = Union @@ pairs[[All, 1]]
},
Prepend[
Replace[t,
Append[
Thread[First@# -> Last@#], _ -> Null
]&/@pairs,
{1}],
t]
]
timeAlign[pairs__List] := timeAlign[{pairs}]
timeAlign[
{{3, 2, 1}, {8, 7, 6}},
{{2, 4, 5}, {{3, 4}, {-1, 2}, {9, 12}}},
{{1, 5, 8}, {a, b, c}}
] // TeXForm
$$\left(
\begin{array}{cccccc}
1 & 2 & 3 & 4 & 5 & 8 \\
6 & 7 & 8 & \text{Null} & \text{Null} & \text{Null} \\
\text{Null} & \{3,4\} & \text{Null} & \{-1,2\} & \{9,12\} & \text{Null} \\
a & \text{Null} & \text{Null} & \text{Null} & b & c \\
\end{array}
\right)$$