s=@(m,n)[a=ones(n,1)*n;b=ones(m,1)*m].*[b;a]'
s(4,3)
s(3,0)
s(1,3)
cz1AKG0sbilbYT1vbmVzKG4sMSkqbjtiPW9uZXMobSwxKSptXS4qW2I7YV0nCgpzKDQsMykKCnMoMywwKQoKcygxLDMpCg==
s =
@(m, n) [a = ones(n, 1) * n; b = ones(m, 1) * m] .* [b; a]'
ans =
12 12 12 12 9 9 9
12 12 12 12 9 9 9
12 12 12 12 9 9 9
16 16 16 16 12 12 12
16 16 16 16 12 12 12
16 16 16 16 12 12 12
16 16 16 16 12 12 12
ans =
9 9 9
9 9 9
9 9 9
ans =
3 9 9 9
3 9 9 9
3 9 9 9
1 3 3 3
warning: product: automatic broadcasting operation applied
warning: product: automatic broadcasting operation applied
warning: product: automatic broadcasting operation applied