Hi
The error "Code generation assertion '-1 < fDTypeID' failed" in MATLAB typically occurs due to data type mismatches within a muxed signal during code generation. This issue may arise when:
- A Mux block contains signals of different data types.
- Specific optimizations in code generation interact with this mismatch, leading to an assertion failure.
To resolve this error, please consider following workarounds-
- Use a Bus Instead of a Mux: Replace the Mux block with a Bus Creator block, as buses can handle signals of different data types properly.
- Ensure Consistent Data Types: If using a Mux, make sure all input signals have the same data type. Use a Signal Specification block to enforce uniform data types before the Mux.
- Use a Demux: If necessary, use a Demux block to separate signals before re-processing them into a bus.
Please use the following command to open documentation for Demux, Mux and Simulink.Bus :