Mg and Na clusters in a helium matrix