MATLAB Answers

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

2 views (last 30 days)
Andrei Baciu
Andrei Baciu on 17 Jan 2020
Commented: Andrei Baciu on 31 Jan 2020
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?

  0 Comments

Sign in to comment.

Answers (1)

Chidvi Modala
Chidvi Modala on 27 Jan 2020
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

  1 Comment

Andrei Baciu
Andrei Baciu on 31 Jan 2020
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.

Sign in to comment.

Sign in to answer this question.


Translated by