In my understanding, you are having trouble while attaching MATLAB process in Visual Studio. I am assuming that you are using Visual Studio 2017.
From Visual Studio menu bar, select Debug>Attach to process
In the Attach to process dialog box that opens, select Native Code in the Attach to list and select the MATLAB.exe process in the Available Processes list and click Attach. You should now be attached to the MATLAB process.