I have n
2-D circles represented by their radii and coordinates of centers.
So, I have nx3
matrix [centers, radii]
.
I want to create nxn
matrix A
so that A(i,j) = max(radii(i),radii(j))
.
I thought it's easy problem but unexpectedly stuck with it.
You can use bsxfun
with the built-in @max
that takes care of the expansion onto a n x n
array and then does the max
finding for each pair of elements. Here's the code -
A = bsxfun(@max,radii,radii.')