How to search .slx files (or convert them to text)
41 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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.
So,
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?
Jay
0 comentarios
Respuestas (3)
Ryan G
el 15 de Mayo de 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.
0 comentarios
Kaustubha Govind
el 15 de Mayo de 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.
0 comentarios
Gavin Walker
el 23 de Mayo de 2013
Editada: Gavin Walker
el 23 de Mayo de 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.
0 comentarios
Ver también
Categorías
Más información sobre Programmatic Model Editing en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!