Obtaining the model topology from a Simulink model

2019-02-14 13:43发布

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条回答
对你真心纯属浪费
2楼-- · 2019-02-14 13:50

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.

查看更多
登录 后发表回答