you need write a .m file to export a mex file eg. make_acado_solver('../../NMPC_controller') then you use the m file to call the mex file in simulink like coder.extrinsic('MPC_ACADO');