- Rename the .slx file of interest
- Generate the .slxp file
- Rename the .slx file back to its original name
How do I specify the name of a protected simulink model (.slxp file)?
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
MathWorks Support Team
el 14 de Nov. de 2025
Respondida: MathWorks Support Team
el 14 de Nov. de 2025
I am using the Simulink.ModelReference.protect command to generate a protected model (.slxp) from a simulink model (.slx). For example, with file test_model.slx:
Simulink.ModelReference.protect("test_model");
This will create a protected model "test_model.slxp".
However, I want to name the .slxp file something different that the original .slx file for organizational purposes and to avoid shadowing conflicts. However, this is not possible according to the Simulink.ModelReference.protect documentation:
"The protected model has the same name as the source model and an .slxp file extension"
Trying to rename the .slxp either manually on the Files pane or using the "movefile" command will render the renamed .slxp file unusable. See command and image below:
movefile test_model.slxp renamed_slxp_file.slxp

Is there any way to specify the name of a .slxp file?
Respuesta aceptada
MathWorks Support Team
el 14 de Nov. de 2025
While renaming .slxp files is not directly supported, here is a workaround to specify the name of a .slxp file:
For example:
movefile test_model.slx renamed_slxp_file.slx
Simulink.ModelReference.protect("renamed_slxp_file")
movefile renamed_slxp_file.slx test_model.slx
The resulting "renamed_slxp_file.slxp" file will be usable as normal. You can even delete the test_model.slx file without issue.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Interactive Model Editing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!