How to save custom Simscape blocks?

9 ビュー (過去 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