离线训练好的神经网络怎样通过MATLAB function调用进Simulink?。
Show older comments
各位前辈好,在做课题的过程中遇到了问题,离线训练好的网络如何通过MATLAB function调用进Simulink,我尝试了三种办法:
1.在Command Window加载了训练好的net,Workspace中可以看到,在M-function中使用 load指令,报错Function 'load' is not supported for code generation. Consider using coder.extrinsic('load') to bypass code generation.说load指令只适用于外部,不能用于Simulink,于是根据建议在load指令前添加了coder.extrinsic('load')在程序中,运行后依然报错Undefined function or variable 'net'.
2.于是我想可能net这个变量没有设置为全局变量,于是我分别在Command Window和M-function中设置和声明了net,依旧报错Global declaration not resolved to a Data Store Memory block registered via the Ports and Data Manager.
3.走投无路的第三种方案,我觉得虽然Workspace中已经存了网络net,但传送不到simulink中,于是我用From Workspace模块把net传进Simulink中,这个方法依旧行不通啊:'(
所以请问怎样在M-function中调用训练好的net,万分感谢各位前辈。
1 Comment
海涛
on 28 Nov 2024
你好前辈,请问你解决了吗
Accepted Answer
More Answers (0)
Categories
Find more on 代码生成 in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!