We solved the problem by implementing a STF_wrap_make_cmd_hook.m function and different (appropriately modified) "setup_for_visual" functions, one for each supported Matlab release (our STF_wrap_make_cmd_hook.m function just checks the Matlab version and calls the corresponding setup_for_visual.m function).
For more information, refer to the "Key Files in the Target Folder" page of the Matlab documentation and have a look at the setup_for_visual.m file which is in the toolbox/rtw/rtw folder of your Matlab installation.