Search code examples
matlabsimulink

Simulink save final state leads to compile error


I have a simpe simulink model

simulink model

It compiles fine unless I try to save output states:

save output states

Then I face with this error when I try to compile it:

Saving the complete set of the SimState is only supported for the model running in Normal or Accelerator mode, and for Model blocks running in Normal mode.

matlab model error

Why does it happen and how to get around that?

Update:

My model is set to fixed step and it is set to normal mode: simulink normal mode


Solution

  • As mentioned in the comments, "building" the model is only for the purpose of generating code/executables, and saving final states is not supported for code generation. If you just want to run the model, just press the "Run" button, not the "Build" button and it should work. See the Simulink documentation for more details on how to run a model.