Code Generation: Subsystems cannot have the same name caused by Matlab function

조회 수: 4 (최근 30일)
Andrei Baciu
Andrei Baciu 2020년 1월 17일
댓글: Ankur 2024년 1월 12일
Code generation: I have an issue regarding generating code from an atomic subsystem which contains a Matlab function. When I try to reuse the subsystem, I receive an error saying that the two subsystems cannot have the same name. This is definitely caused by the Matlab function, because if I comment it, I recevie no such error. Can I change the configuration of the Matlab function so I can resolve this error or is my only solution to remove the Matlab function? If there is a method, could you please help me?

답변 (2개)

René Pätznick
René Pätznick 2021년 7월 16일
The function name '$N$R' for code generation in subsystem '...' is not a valid function name.
I got this message when using the placeholder within the library

Chidvi Modala
Chidvi Modala 2020년 1월 27일
You may need to specify Unique Function Interface Names
Each function interface corresponding to the same reusable library subsystem must have a unique name. To specify a unique name, follow these steps:
  1. In the Subsystem block parameters dialog box, on the Code Generation tab, set the Function name options parameter to User specified.
  2. For the Function name parameter, specify the $R and $N tokens. The $R token represents the function interface name. The $N token represents the subsystem name.
  3. In the Create Function Interface dialog box, for the Name parameter, specify a name that describes the context.
  4. Set the File name option parameter to Auto or Use function name.
You can refer to this documenatation
  댓글 수: 2
Andrei Baciu
Andrei Baciu 2020년 1월 31일
Thank you for the answer. This is not exactly what I had in mind, I wanted to reuse the atomic subsystem, which also had the Matlab function. I managed to solve my problem though, I found a way to implement the function with Simulink blocks and now it works quite well.
Ankur
Ankur 2024년 1월 12일
Hello Andrei, whats the solution to this issue which worked for you?

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

카테고리

Help CenterFile Exchange에서 Simulink Functions에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by