Updatemenus Matlab

I found a related topic: Interactive Legends
However, also there the Matlab version of the script does not run properly.