Changed behavior of SL coder in R2016b

Hello!
We are now moving our Project from R2014b to R2016b. Unfortuntately the code generation does no longer work.
After some Debugging we found that the value of "slfeature('SLCGFileRepositoryInTLC')" changed from 0 to 1 in R2016b. This value is assigned to the global value "UseSLCGFileRepository" in setuplib.tlc, line 1455. In codetemplatelib.tlc, function "SLibAddModelFileWithBasename" (called by "LibCreateSourceFile") now the if-path is evaluated instead the else-path, so the ModelFile has only the entry "Index". This is crucial because in our project we access the attribute ModelFile.Name in further processing which is now no longer populated (else-path!).
We would be happy if you could explain us this this changed behavior and if possible give us a solution resp. a workaround.
Thanks in advance!!
Greetings
Matthias

4 Comments

Hello Matthias and other readers,
I'm facing exactly the same issue, but already when upgrading our projects from R2014b to R2015b. We try to access the attribute ModelFile.Type in our own TLC files - and fail, as there is only the "Index" entry. The displayed error is:
Unable to find Type within the ModelFile scope
  • Is there any workaround or bug fix available?
  • And, by the way, is there any chance to get these changes before running trough dozens of errors and without debugging through MathWorks files each time? I.e., are there kind of release notes for changed behavior in TLC scripting?
Thanks in advance and best regards
Thomas
@Thomas, I see you are in contact with Technical Support. I am not sure yet, whether the issue here is part of your request or not. I will have a look at those cases later today and make sure all point are adressed.
@Matthias: I do not see a Technical Support case from your side. I will create one for you an get in touch later today.
Thomas Becker
Thomas Becker on 18 Oct 2016
Edited: Thomas Becker on 18 Oct 2016
I have just written a case for technical support (02228944).
I hope to post the answer, as soon as I will get an answer.
Hello again,
there came a fast answer from MathWorks support/development:
Customers should now use the LibGetFileRecordName function, passing in the srcFile record. This will return the same thing that srcFile.Name did, and will be documented for 15a. Customers should avoid using the file record directly, and use the documented API going forward (i.e. LibGetModelFileAttribute or LibGetSourceFileSection).
In my case, I use
%assign fileName = LibGetModelFileAttribute(fileIdx,"Name")
%assign fileType = LibGetModelFileAttribute(fileIdx,"Type")
%assign CodeTemplate = LibGetModelFileAttribute(fileIdx,"CodeTemplate")
now, and it works fine for at least MATLAB R2013b/R2014b/R2015b.
Best regards
Thomas

Sign in to comment.

Answers (0)

Categories

Find more on Simulink Coder in Help Center and File Exchange

Asked:

on 11 Oct 2016

Commented:

on 21 Oct 2016

Community Treasure Hunt

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

Start Hunting!