MATLAB Answers

0

Generate code from referenced model without generating from the parent

Asked by Guilherme T Silva on 8 Apr 2019
Latest activity Answered by Nick Sarnie on 13 May 2019
When working with large systems made of many referenced models I can either generate code from the top-level model (parent), which creates a separate .c file for each one of the children, or I can generate code only from one of the child models. The step function for the referenced model changes wether the code is generated from the parent or from the child model, so if I update the child I need to generate code from the parent, otherwise the child models will generate code in standalone mode. The problem is that this can be very time consuming, even if the top level model and most of the referenced ones are unchanged.
Is there a way to generate code only for a referenced model, while keeping the interfaces it had when it wasn't generated as a standalone model?
I'm sending a model attached (R2018a) to exemplify the problem I'm trying to solve. Notice how the code in ReferencedModel.c changes when you generate code directly from it or from its parent model (ParentModel.slx).

  0 Comments

Sign in to comment.

1 Answer

Answer by Nick Sarnie on 13 May 2019

Hi Guilherme,
Does using "slbuild(modelName, 'ModelReferenceRTWTarget')" solve your issue?
Thanks,
Nick

  0 Comments

Sign in to comment.