Changing resolution when switching to projector

Hi,
I’m using my Pi2 with a screen and a projector. I use a HDMI Matrix to switch between these two by sending ir signals when the Pi is already powered on.
Almost everything works just fine besides it doesn’t change the resolution automaticly.
So how can I change config.txt in order to change the resolution depending on the screen?
If that isn’t possible how will I be able to change the resolution by command line spontaneously?

This isn’t possible. The pi reads EDID at boot to determine valid resolution. It can’t be done on the fly. So, reboot required.

What about changing it in the terminal? I can manage to change the reolution in the options without rebooting.

No, because if both devices don’t report both resolutions as being available then it will not even be a choice to select in Kodi either via GUI or other means.

If you’re changing both HDMI device and resolution on a Pi you really do need to reboot so it can pick up the new EDID.