How do I unlock a Simulink library to make it editable?

5.8k views Asked by At

Simple question - how do I unlock a Simulink (i.e. part of MATLAB) block library to edit it?

1

There are 1 answers

0
LightCC On

There are two ways to unlock a library:

  1. Direct UI method - Ultra-simple, good in at least Matlab 2019a and later - after opening the library, in the bottom left corner of the library window, there is a "lock" icon. Click it.

    enter image description here

    The Library will automatically relock after saving and closing it.

  2. Programmatically Unlock the Library

    • Open the library (directly or programmatically)
    • Use the following code, where my_library is the base name of the library without the *.slx extension:
set_param('my_library', 'Lock', 'off');

Note:

  • If the library is currently the Simulink window in focus, you can use the gcs command (get current system) instead of the my_library name.

  • set_param(gcs, 'Lock', 'off');