You could also try using cell arrays. Cell arrays may be a little slower, but they can do the job.
photon_timestamps{i} = vector;
then each element photon_timestamps{i} can be of different size.
also your block
if timestamp == 0
continue;
end;
needs a else part right?