Are you doing this by interfacing NetSim & MATLAB.?
If yes then a video explaining this is available at https://www.youtube.com/watch?v=-c9zGfwci2g&list=PLS8vhyBd_bXnaHfQ0YS077FnYee4-_5OZ and https://www.youtube.com/watch?v=SP6kg0KD78o&list=PLS8vhyBd_bXlG_mD2CqGufiMCJ-AHJbSV&index=13 (around 9min 30 s)