如何检索状态块的句柄?软件

How to retrieve Handle of a State block ? Matlab

我实际上是在尝试使用 Matlab 代码构建一个 Stateflow

我想知道是否可以检索状态块的句柄。我尝试使用 get_param() :

state_handle = get_param('System/Chart/State_ON', 'Handle');

但是 returns 我 :

No block called 'State_ON' could be found.

是否有其他解决方案可以使用状态名称获取句柄?

编辑:我找到了 post 解决方案

好的,经过多次研究,有 2 个解决方案:

For version R2017b and after

StateHandle = StateFinder(Chart Handle)

For versions before R2017b

state_handle = ch.find('-isa','Stateflow.State','-and','Name', 'State_ON');