Pixhawk Cube Black to PC

I am working on a Pixhawk Cube Black based quadrotor system project. There seems to be an issue with the COM ports. The USB serial port has 5 COM ports, as shown in the image. The port that is available most of the time is ‘Legacy FMU (COM5)’, but while trying to upload the default firmware through ‘MATLAB UAV Toolbox Support package for PX4 Autopilots’ I have learnt that ‘ProfiCNC CUBE F4 FMU (COM4)’ is the port required for loading codes into the flight controller. I had to reboot the flight controller a few times to get the port to come online, also it comes online only for a about a few seconds within which the code upload had to start. This strategy of rebooting the flight controller multiple times doesn’t seem to work when uploading code through Simulink, because Simulink requires the flight controller to be already connected the PC while starting up the code generation sequence. Can someone help me regarding this problem.
image