MATLAB: Can I store multiple outputs of a function into a cell

cellmeshgridndgrid

I am using the function 'ndgrid' to construct a n-dimensional mesh. But I would like to generalize my programme for n-dimensions.
Is there any way where I could store the outputs of the function into a cell, as the number of outputs depends on the number of dimensions.
Something like :
X{:} = ndgrid(x{:})

Best Answer

x = [{1:10} {1:10}] ;
[I{1:numel(x)}] = ndgrid(x{:}) ;
I