The Strategy design pattern can be implemented in MATLAB using function handles. Here is an example of how to implement the Strategy pattern using function handles:
main.m270 chars16 lines
main.m92 chars6 lines
main.m124 chars8 lines
main.m62 chars3 lines
main.m190 chars6 lines
This implementation allows for easy swapping of the strategies by simply passing in a different function handle to the Context constructor.
gistlibby LogSnag