MATLAB: How to use set_param to set multiple commands in a model callback, separated with new lines in Simulink 7.6 (R2010b)

callbacklinemodelnewsimulink

I want to automatic change the model callbacks. Therefore I use get_param to check which callbacks are populated and read the used command.
Now I would like to add commands to these callbacks. If I use set_param I need to write all commands at once, otherwise the existing commands will be overwritten.
This creates very long strings and makes it very uncomfortable to read. Is there a way to write the callbacks and insert new lines between commands?

Best Answer

To do this you can use the following code:
z = 'command 1';
x = 'command 2';
set_param(gcs,'PreLoadfcn',sprintf('%s \n %s',z, x))