How to save custom Simscape blocks?

조회 수: 8 (최근 30일)
Wilfred
Wilfred 2017년 5월 11일
댓글: Wilfred 2017년 5월 12일
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.

채택된 답변

Sebastian Castro
Sebastian Castro 2017년 5월 12일
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
  댓글 수: 1
Wilfred
Wilfred 2017년 5월 12일
Thanks again! It works now. (I thought I already tried this but that was at an earlier stage when I had also made other mistakes)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by