I'm not entirely sure of the data you're working with, but I can make the suggestions below:
In a for loop, you can iteratively set values to indices of an array up until the row size of your multiND. Once these are all set, you can use the sum function to get the actual sumof all the ND values.
Cheers,
Jakeb
Ex.
x = rand(32,1);
s = length(x);
for idxSomething = 1:32
s(idxSomething,1) = x(idxSomething,1)*32+32;
end
sumX = sum(s);