How do I find out if simulink is in sim or coder mode?
1 view (last 30 days)
The basic problem is: If I simulate (by clicking on the green play button in simulink), I want to receive data by an UDP Block. If I generate code (e.g. hit Ctrl+B) the inports shall be used to receive data and no UDP communication shall be done (also no UDP socket shall be initialized). Anyway, using the Environment Controller block leads to a generation of the UDP Code because this block is a S-Function. As a workaround, I want to exchange the UDP Block by the inports programmatically during the initialization if the "Coder flag" is set. But how do I get this flag?
Wilson A N on 8 May 2017
You can obtain the 'Coder flag' by using the following command:
>> k = get_param(<modelName>,'GenCodeOnly');
You can programmatically set it using the following command: