Simulink保存最终状态导致编译错误

Simulink save final state leads to compile error

我有一个 simpe simulink 模型

编译正常,除非我尝试保存输出状态:

然后当我尝试编译它时遇到这个错误:

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.

为什么会发生这种情况以及如何解决这个问题?

更新:

我的模型设置为固定步长并且设置为正常模式:

如评论中所述,"building"模型仅用于生成code/executables,代码生成不支持保存最终状态。如果您只想 运行 模型,只需按 "Run" 按钮,而不是 "Build" 按钮,它应该可以工作。有关如何 运行 模型的更多详细信息,请参阅 Simulink documentation