How can I update the data in slx file without matlab/simulink?
23 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaire
Haritha
le 17 Août 2018
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.
Réponse acceptée
ES
le 17 Août 2018
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 commentaires
Plus de réponses (1)
Walter Roberson
le 17 Août 2018
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.
Voir également
Catégories
En savoir plus sur Programmatic Model Editing dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!