フィルターのクリア

How can I update the data in slx file without matlab/simulink?

35 ビュー (過去 30 日間)
Jitesh Patel
Jitesh Patel 2018 年 8 月 17 日
コメント済み: Jitesh Patel 2018 年 8 月 17 日
I am trying to automate few things and as a part of this, I want to change few things from the SLX model. I am aware that the SLX files are zipped files based on OPC format. So the question is - is it possible to extract the slx files in a folder, modify the content, zip it back and rename to slx?
I am getting error on performing the above steps as shown below: "Error using open (line 145) File 'C:\Test.slx' does not contain a valid Simulink model in SLX format: Content types stream does not exist"
Is there any particular setting that I need to set in 7zip to create the zip archive?
Regards and Thanks, Jitesh
  1 件のコメント
Haritha
Haritha 2018 年 8 月 17 日
first, extract the zipped files and in the main window, we have an option to browse for a folder. Then open the slx file now run it. If you have the same problem again means some blocks are updated from lower version to higher version.

サインインしてコメントする。

採用された回答

ES
ES 2018 年 8 月 17 日
Its much simpler.. When you zip again, dont select the whole folder. Select the sub-folders and zip.
In other words, when you zip it after your changes, and double click, you should see _rels, metadata, simulink, [Content_Types].xml within the zip AND NOT A FOLDER which inturn has the above folders.

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2018 年 8 月 17 日
I followed these steps on my Mac:
!cp /Applications/MATLAB_R2018a.app/toolbox/physmod/powersys/powerdemo/power_electronics/power_switch.slx .
!unzip power_switch.slx
cd simulink
edit blockdiagram.xml
Change InstanceData for AC Voltage Source: Amplitude from 120*sqrt(2) to 120*sqrt(3), Phase from 0 to 1. Save.
cd ..
!zip -r new_power_switch.slx '[Content_Types].xml' _rels metadata simulink
open_system('new_power_switch.slx')
The properties of the AC Voltage Source were indeed updated.
On Windows systems, you would probably need slightly different commands.
The -r option of zip is important for this purpose. It is the "recursive" option, saying that all files and directories underneath the explicitly named ones should be included.
  1 件のコメント
Jitesh Patel
Jitesh Patel 2018 年 8 月 17 日
Thank you - it worked. Sadly could not accept both answers at the same time.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeProgrammatic Model Editing についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by