If I try plotting variables in the Simulation Stop Function of my ".mdl" file, the function fails and the generate process exits. How can I exit the Simulation Stop Function when performing a generate in System Generator for DSP?
This occurs because System Generator for DSP is incorrectly calling out the Simulation Stop Function before the Simulation completes in Simulink and the variables it is trying to access have not been created yet.
To avoid this issue, follow these steps:
1. Remove the offending variable from the Simulation Stop Function.
2. Uncheck create testbench or check for the variable that is failing and also check to see if it is empty in the function. If it is empty, exit the function and continue with the generation process.
if ((~exist('ySignal','var') & ~exist('NPixels','var')) || (~isempty(ySignal)))