Firstly it is important to note that processing a sequence of .mat files is much simpler when the variable names inside each file are exactly the same. This applies to both reading and writing them. Then you could trivially do this:
for slice = 1:d(4)
file = sprintf('layer_%d.mat',slice);
data = squeeze(reducedData(:,:,:,slice));
Note how I wrote simpler, much more efficient code than what you have in your question, and that I saved the slice value too, so you know exactly which slice it is when you load that data:
S = load(...
Simpler to write, simpler to read, much more efficient: why waste your time fighting eval ?
If you really want to have lots of numbered variables (which are a sign of bad data design, and bad code), then you could split the data into the fields of a structure, and save that structure using the '-struct' option. But of course that would be slow, complex, and not recommended.