Why does the retina on my Macbook pro completely freeze when connecting to an external monitor?

Retina Macbook pro completely freezes when connecting external monitor.

My computer is a late 2013 rMBP model number MacBookPro11,3

Specs are i7 2,3 Ghz, 16GB Ram, 512 ssd, and a GT750m discrete GPU. Everything is completely original.
It is running the latest official version of OS X el-capitan.

When I plug in my external monitor, which is a philips bdm4065uc 40" 4k monitor, using an original apple mini-dp to mini-dp cable, the screen goes blank and the computer completely seizes up. Nothing I do has any effect. Only thing I can do is hold the power button for 10 seconds to do a hard-shutdown.
It only happens in OS X. It works fine in bootcamp using windows 10 so I guess it is a software issue.
I also tried booting windows 10, plugging in the monitor and then booting back to OS X with the monitor connected but OS X froze during boot with the same blank screen and unresponsive computer.

The hdmi port works fine also in OS X.
Re: Retina Macbook pro completely freezes when connecting external monitor.

Hopefully, someone who has a remedy will respond soon.
Re: Retina Macbook pro completely freezes when connecting external monitor.

Thankfully there is no need. I tried plugging it in this morning and it worked.
I tried a few times to recreate the problem but it seems to have fixed itself by magic.

Original thread: https://forums.imore.com/threads/why-does-the-retina-on-my-macbook-pro-completely-freeze-when-connecting-to-an-external-monitor.347797/