Obtaining the model topology from a Simulink model

女生的网名这么多〃 提交于 2019-11-30 17:40:20

问题


I would like to create a structure in Python which represents a Simulink model. I am aware of at least two ways of doing this - by parsing an ".mdl" file, or by using Matlab's api for communicating with the model.

Can you recommend good libraries or APIs for doing this?

In particular, I need to perform some processing on a Simulink model and I would like to do it in Python. Also I don't want to be constantly communicating with Matlab for doing this (so that I can release the floating license).

I have seen some parsers online, but they seem to be a little limited, usually not supporting components such as Bus Creators and Bus Selectors, Muxes, Demuxes, and reading UserData information.

Any help will be greatly appreciated.


回答1:


Not my area, but noticed this Python parser which may be helpful.

Or you can purchase the Simulink Report Generator in order to save/manipulate the model as a XML file.

Or the *.mdl file is a readable ascii file. You could read it into a string with a fread statement, alter the string, then either save it to your format of choice or write it back out to a *.mdl file. My coworker thought of this, not me! But would require doing the editing/parsing with a routine you write yourself.



来源:https://stackoverflow.com/questions/9141062/obtaining-the-model-topology-from-a-simulink-model

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!