How do you switch your Pokemon in Pokemon platinum?

While out of battle, you press X, then go up to "POKEMON" and tap on the Pokemon you want to switch, then tap on the other Pokemon you switch with and it'll place the first Pokemon you chose to that second Pokemon's place. In battle, you tap on "POKEMON" on the bottom right corner and tap on the Pokemon you want to switch out with and select "Switch" to bring that Pokemon into battle.