How to save custom Simscape blocks?

10 visualizaciones (últimos 30 días)
Wilfred
Wilfred el 11 de Mayo de 2017
Comentada: Wilfred el 12 de Mayo de 2017
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.

Respuesta aceptada

Sebastian Castro
Sebastian Castro el 12 de Mayo de 2017
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 comentario
Wilfred
Wilfred el 12 de Mayo de 2017
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)

Iniciar sesión para comentar.

Más respuestas (0)

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by