1. Make sure that the following directory is in the environment variable PATH: 

<Path where MATLAB is installed>\bin\win32


For eg: "C:\Program Files (x86)\MATLAB\R2011a\bin\win32"


By default only the path till the bin folder of MATLAB will get added to the path variable. i.e 

"C:\Program Files (x86)\MATLAB\R2011a\bin"


2. Also make sure that you run NetSim in Admin mode, by right clicking on the NetSim shortcut icon in the desktop and selecting Run as Administrator, whenever you are interfacing NetSim with MATLAB.