MATLAB: How to efficiently obtain a slice of a matrix / Can I obtain a reference to a slice

matrixmatrix arrayoptimization

Using a mex file, I create a matrix with approximate dimensions 150x150x150x15000. It is essentially 15,000 3D masks. I am currently trying to access each mask using:
for i=1:15000
mask = matrix(:,:,:,i);
end
but this takes (what I feel to be) an excessive amount of time (approx 50s), presumably because it is creating a new matrix from each slice. Is it possible to obtain a reference to each slice instead?
I have tried creating an array of structs each with their own reference to a matrix and access like so:
for i=1:15000
mask = array(i).matrix
end
but then the creation takes even longer due to all of the memory allocations!
Any help would be much appreciated.