I am new to Matlab. I wanted to use Simscape resistor element and want to make it Temperature dependent. However i open the code of the component by view source code. I modify the code but couldn't save it. It gives only option to save as "Save as" . If i save as to new .ssc file then i cannot run that code to generate the component either. Your suggestions and opinion regarding this issue will be appreciated. Thank you!!


1 Answer 1


There are three steps that are required to include a custom simscape component into simulink

  1. Suitable directory tree structure

Simscape expects component source to be listed in a directory structure prepended with "+" and within the MATLAB search path ( file --> set path)

Take for instance /home/USER/Documents/MATLAB is listed in the MATLAB path search list, I can create a custom simscape file hierarchy from here:


Within this new directory I can save my simscape part

  1. Build the simscape part.

With a valid Simscape structure existing, a library part can be "compiled" via the ssc_build command

ssc_build +custom

where +custom is the structure that was created. This will create within /home/USER/Documents/MATLAB/ a custom_lib.mdl file, a valid Simulink library that can be opened & your custom part dragged out

  1. Adding a custom library to the main library browser

For this to work a slblocks.m file is required

function blkStruct = slblocks
        % This function specifies that the library should appear
        % in the Library Browser
        % and be cached in the browser repository

        Browser.Library = 'custom_lib';
        % 'mylib' is the name of the library

        Browser.Name = 'My Library';
        % 'My Library' is the library name that appears in the Library Browser

        blkStruct.Browser = Browser;


Your user library and custom part will now appear in the simulink browser

  • \$\begingroup\$ Thank you JonRB for your time and suggestions. Your suggestion worked for me, apart from including '+' sign for compiling using command ssc_build custom no + sign required for my Matlab version 2014 and 2015. \$\endgroup\$
    – Kajiram
    Oct 23, 2015 at 2:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.