Azzera filtri
Azzera filtri

How to search .slx files (or convert them to text)

50 visualizzazioni (ultimi 30 giorni)
Jay Gowdy
Jay Gowdy il 15 Mag 2013
I have a directory structure full of dozens of .mdl files with probably hundreds of Simulink blocks that share common EML code. These .mdl files are NOT all in a single hierarchy of referenced sub-models.
A few times a year we change some of the common code and I want to find every instance of some piece of EML code in all of my model files, so I just fire up find and grep and use them to identify which .mdl files have EML blocks that use what I am searching for, and I can usually tease out from the .mdl file which EML block to go to.
With more recent Simulink releases (we are currently using 2012b), it appears I have no choice but to create models as .slx files, which are binary, not searchable, and not readable.
1) is there a way to search a directory structure full of arbitrary .slx files for arbitrary text in all the contained EML blocks? 2) if not, is there a way to convert .slx files to text so I can search them as I do .mdl files 3) or, is there a way to convert .slx files to .mdl files so I don't have to work with it in the first place?

Risposte (3)

Ryan G
Ryan G il 15 Mag 2013
First, I would recommend finding a way to do this without using the actual text. That being said, you can open up a .slx file with any normal unzip program. Inside you will find all the data contained within the model that you had found previously.

Kaustubha Govind
Kaustubha Govind il 15 Mag 2013
You should be able to use save_system to resave a model in the .mdl format, but like Ryan suggested, I would recommend not relying on find/grep. Ideally, you would load each model, and use the Stateflow API to access the code in each MATLAB Function block. See How do I specify the MATLAB code for the function in an Embedded MATLAB Function Block from the MATLAB command line? to get started on this idea.

Gavin Walker
Gavin Walker il 23 Mag 2013
Modificato: Gavin Walker il 23 Mag 2013
Just to add one other item: you can decide if you want the MDL or SLX file format to be your default. Go to the Simulink Preferences and set the "file format for new models and libraries" to be what you'd prefer.


Scopri di più su Programmatic Model Editing in Help Center e File Exchange


Community Treasure Hunt

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

Start Hunting!

Translated by