How can I update the data in slx file without matlab/simulink?
조회 수: 27 (최근 30일)
이전 댓글 표시
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
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
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.
댓글 수: 0
추가 답변 (1개)
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.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!