You could use cell arrays. Cell arrays allow you to store data of different types (strings, ints, doubles, arrays, etc.) all in the same data structure. They also allow different sized arrays to be stored together.
P = cell(1,a);