reshape(cat(3,P{:}),[numel(P{1}) n])
Of course, the above solution is just for fun. I would recommend profiling both solutions and using it only if it has a significant performance advantage.
Service and readability are also very important factors to consider when writing code.
source
share