Well, the keyword option is nicer in the sense that the programmer can't
make a mistake when choosing which dimension to squeeze on... There's no
need to type 'd' twice. I would even go as far as to say that a separate
function would be useful. I often want to "remove" a dimension by mean,
sum, std
You can always combine them into a single line:
mu1 = squeeze(mean(a, d), d)
I'm not sure I have any ideas for how to make it more convenient. Are you
thinking in terms of a keyword argument? Note that
mu1 = mean(a, d, squeeze=true)
is not any shorter.
--Tim
On Monday, April 28, 2014
I guess I can understand why the dimension of the mean of a say 3-dimension
array along the (say) third dimension is still a 3-dimensional array with a
singleton (say) last dimension. But is there any better way to remove that
dimension than:
d = 3
a = rand(3,5,10)
mu1 = mean(a,d)
mu = squeeze(