How to create a dataset with 2d and 3d slices

I would like to create a 2d+1d and a 3d+1d in a dataset array. I have a
simulation who gives me a 2d or a 3d array and I want to keep some of this
data at some specif times in a extra dimension. Someone has a hint of how
do that, or a example?

Thank you all!