I am using Matlab 2012a and the [Simulink Coder (aka Real-Time Workshop)](http://www.mathworks.com/products/simulink-coder/). I want to compile the model using Simulink Coder but preserve the functionality of model callbacks.

---

Consider the following simple example. I have a Simulink model, `callBackTest`, which reads in a constant and outputs to a since. `input1` is defined in `myValues.m` and loaded into the model workspace using the [PreLoadFcn model callback](http://www.mathworks.com/support/tech-notes/1900/1903.html#7). The PreLoadFcn callback is executed when the model is first opened. By using the PreLoadFcn callback, `input1` will automatically be defined every time the model is opened.

![Simulink Blocks](https://i.stack.imgur.com/3k66Z.png)

![PreLoadFcn](https://i.stack.imgur.com/W9nNc.png)

Suppose `myValues.m` is originally coded as `input1=1`. When you run the simulation, `yout` will be an array of 1s. Also if I compile the model using the Simulink coder, the output will also be an array of 1s. However if I modify `myValues.m` so that `input1 = 2` and do not recompile, the realtime output is still 1. This is wrong, so how can I read variables from a file into the model workspace with a compiled model?