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 12:05:37 AM Yakir Gagnon wrote: > 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(mu1,d)
