Tried it on Pokemon White (E). Doesn't seem to work for me. I tried it in a trainer battle and a wild battle, and in both instances my sigilyph still got all the exp. I assumed the Lucky Egg might've been interfering and tried again after removing it. Still didn't work.
Also, you should try making a code like this for a single pokemon, instead of the whole team. For example, only the pokemon in the 2nd slot gets experience. That'll let you train a weaker pokemon without having to do the 'send it in, switch it out' routine.