Frequently Asked Question

MATLAB: How to resolve an error while generating the testframe with Matlab 2018b and Simulink Coder?
Last Updated 3 months ago

When using MATLAB 2018b with Simulink Coder/Embedded Coder there may occur an error while saving the testframe. This problem was reported to Mathworks, but there is no official solution available yet.

Therfore you can use a workaround, where you define a "Load Script" in TPT. Navigate to:

MATLAB Platform Configuration -> Original Model -> Load Script

and insert the following code as your "Load Script":

tpt_callbacks = get_param('${tpt.matlab.modelname.original}', 'Callbacks');
if isfield(tpt_callbacks.PreSave, 'CoderDict_ErrorIfMDL')
    tpt_callbacks.PreSave = rmfield(tpt_callbacks.PreSave, 'CoderDict_ErrorIfMDL');
end
if isfield(tpt_callbacks.PreSave, 'AutosarSaveAsMdl')
   tpt_callbacks.PreSave = rmfield(tpt_callbacks.PreSave, 'AutosarSaveAsMdl');
end
set_param('${tpt.matlab.modelname.original}', 'Callbacks', tpt_callbacks);

In newer versions of TPT, this issue is bypassed by TPT automatically.

Please Wait!

Please wait... it will take a second!