필터 지우기
필터 지우기

How to convert *.slx model to *.mdl using m script?

조회 수: 12 (최근 30일)
Partha Mitra
Partha Mitra 2018년 9월 14일
댓글: Andreas Goser 2018년 9월 14일
How to convert *.slx model to *.mdl using m script?

채택된 답변

Niklas Nylén
Niklas Nylén 2018년 9월 14일
편집: Niklas Nylén 2018년 9월 14일
load_system('mysys.slx')
save_system('mysys', 'mysys.mdl')

추가 답변 (1개)

Andreas Goser
Andreas Goser 2018년 9월 14일
Please check the save_system command:
doc save_system
E.g. I find "filename = save_system(sys,newsys) saves the model to a new file newsys. If you do not specify an extension, then save_system uses the file format specified in your Simulink® preferences.". So I would expect if you set that in Simulink's "Model File Preferences", it would work. Try it out.
I wonder however why you want to do this. I have a certain understanding in users have sometimes a need to backport to an older release, but why using the older file format in the same release?
  댓글 수: 2
Niklas Nylén
Niklas Nylén 2018년 9월 14일
There are several possible reasons, although I don't know the motivation in this particular case:
- Version handling of binary files in GIT is slow and increases the repo size compared to text based formats
- The possibility to do search and replace in a simple way
- Possibility to fix certain warnings* that require editing of the text based format. What I usually do in this case is to rename the file .slx -> .zip and edit the xml file but it adds extra steps.
*An example of these warnings is that if someone who has dspace installed saves any model there are dspace references added, even if no dspace blocks are used. This will create warnings during model load for anyone who does not have dspace installed. The only way to get rid of these references is to edit them out manually.
*Another example is if a model is being worked on in Japan it can result in invalid characters being added, which makes the model not work in a non-Japanese environment anymore. (I don't know if this problem has been resolved in newer Matlab versions)
Please give us an option to save the model as an uncompressed XML file if the mdl format is obsolete. It would solve a lot of issues we have!
Andreas Goser
Andreas Goser 2018년 9월 14일
Niklas, thank you for sharing the reasons. It is important for me to verify MathWorks Developers are aware of this. I see you have contacted Technical Support a few weeks ago for a different type of question and hope your experience was positive. I suggest you contact Technical Support again with your requests. Each enhancement request will be tracked separately and also made sure development gets quantitative and qualitative information about them.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Programmatic Model Editing에 대해 자세히 알아보기

제품


릴리스

R2014a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by