Let M denote the set of all complex n×n matrices whose columns span certain given linear subspaces. The minimal Euclidean condition number of matrices in M is given in terms of the canonical angles between the linear subspaces, and optimal matrices in M are described. The result is also stated in terms of norms of certain projections.