MATLAB: How to relax the check for strictly monotonically increasing breakpoints for Dynamic Lookup Tables in R2015b to get same behavior as in R2012b

breakpointsdynamicEmbedded Coderincreasinglookupmonotonicallyr2012br2015bstrictlytables

I have breakpoints that can dynamically change, and in R2012b I used the Lookup Table Dynamic block to feed in the breakpoints. However, upon moving to R2015b, I get the following error:
In block 'InterpolationIssue/Lookup Table Dynamic', the xdat vector is the breakpoint data, which must be strictly monotonically increasing.
How do I revert the behavior of this block in R2015b to be like R2012b, where it does not matter? I have deployed production code using R2012b before, and thoroughly tested it, and did not encounter any such issues.

Best Answer

Simulink R2012b permitted this behavior because of a bug which did not check the monotonicity of the points; this bug was fixed in R2014b. Please note, however, that the documentation has always stated this as a requirement.
Non-strictly monotonically increasing breakpoint data violates the assumption of algorithms used by the Lookup Table Dynamic block, which could lead to silent wrong answers.
However, included is a suggested start for a workaround which will take a set of dynamic breakpoints, which may not have unique breakpoints, and eliminate these breakpoints at run-time while still operating with fixed-sized arrays at run-time. It does so by removing the non-unique points, and then prepending or appending data to simulate saturation if there is enough space between the minimum / maximum values to avoid overflow or underflow. This workaround was created with the following goals in mind:
1) Provide a temporary means to allow data with non-unique breakpoints to be allowed.
2) Allow for existing instrumentation to remain in place.
3) Throw an error in simulation if the workaround will not function correctly (will cause underflow or overflow if attempting to pad), and optionally halt execution in generated code. For more information, see the commented lines in the "bp_unique" MATLAB Function block.
To execute the example, download and extract the attached archive, "bp_unique_workaround.zip", and execute:
>> bp_unique_workaround_test
This example will show how the padding changes based on the limits of the "uint8" breakpoint data. You may also uncomment the block indicated in the diagram to see how this workaround handles error behavior.
Please note that this workaround is a suggestion in how you may proceed forward with transitioning your interfaces to prevent unique breakpoints from being introduced. It has not been thoroughly tested, is only a suggestion (and not officially supported by Technical Support), and should be reviewed before using it.
It is suggested to robustify the operator interfaces to prevent conditions where the operator might be able to specify a set of breakpoints that may not be unique.