title: Setting initial values in an FMI toolbox block using Matlab
body: <p>(This question is similar to  previous question I have posted, but the situation has changed...)</p>
  
  <p>I am using the Modelon FMI toolbox for a Dymola/Simulink interface to import a Model-Exchange type fmu file (version 1.0) into the Simulink model. I have a Matlab m-file that programmatically simulates the model sequentially, saving the final internal states of the model for initialization in the next simulation. </p>
  
  <p>The simulation call in the m-file is:</p>
  
  <pre><code>simOut_itr = sim(model, model_cs);
  </code></pre>
  
  <p>Where “model” is the Simulink .slx model file and “model_cs” is a Simulink Configuration Setting variable. I have set the Configuration such that the model loads initial states from the workspace, and I have saved the previous iterations final states to that workspace variable. </p>
  
  <p>However, when I run my code, the initialization values do not set in the model, and the results of the simulation show that the model outputs reset to their initial values each time the simulation is run. This behavior indicates to me that the states are not initializing using the workspace variable values, but no error is set during the simulation. I have confirmed that loading and unloading the model for each iteration does not help.</p>
  
  <p>Any suggestions with regard to initializing the system states in fmu files in Matlab/Simulink are much appreciated. Thank you.</p>