MATLAB: How to save custom Simscape blocks

custom blocksdirectoryfile managementlibrariesSimscapesimscape languagesimulink

Based upon a suggestion I got on this forum, I modified the Matlab code of a convective heat transfer block with the aim to create a custom Simscape block. But how do I save this as a Simscape block that I can use? According to instructions here and here, I did the following:
I made sure that I was working in a directory that is on the MATLAB path.
In this directory I created a subdirectory +Fridge, and saved the modified MATLAB code of the convective heat transfer block in this directory as varconvection.m
Then, from the parent directory of +Fridge, I ran the command ssc_build Fridge ….
Only thing that happens is that I get an error message: Generating Simulink library 'Fridge_lib' in the current directory 'D:\wvandervegte\SURFdrive\FALCON\Simulations' … Warning: Not generating Simulink library 'Fridge_lib' as the MATLAB package 'Fridge' is empty and does not contain any MATLAB files (.m) or Simscape model files (.ssc).
However there is a .m file in this directory, namely varconvection.m
What am I doing wrong???
Any help greatly appreciated.

Best Answer

Assuming your code is correct, all you have to do is change the extension of varconvection.m to varconvection.ssc.
Simscape source files use the .ssc extension, so ssc_build wasn't seeing one of those in your package folder.
- Sebastian
Related Question