mpt.parameter Structure Values Being Variant Dependent

조회 수: 19 (최근 30일)
Mahmoud Hassanien
Mahmoud Hassanien 2019년 11월 7일
댓글: Mahmoud Hassanien 2019년 11월 17일
I have an mpt.parameter where value is a struct and data type is a Simulink.Bus.
For example:
tmp = mpt.Parameter;
% myStruct is supposed to be a struct defined before
tmp.Value = myStruct;
% myDT_tstrCalib is supposed to be a Simulink.Bus defined before with elements as many as myStruct
tmp.DataType = 'Bus: myDT_tstrCalib';
tmp.CoderInfo.StorageClass = 'Custom';
tmp.CoderInfo.Alias = 'myAlias_strCalib';
tmp.CoderInfo.CustomStorageClass = 'myCSC';
tmp.CoderInfo.CustomAttributes.MemorySection = 'RAM_CAL';
What I use in simulink blocks is
tmp.x
where x is a field in myStruct.
The upper code produces a structure with names as in myDT_tstrCalib and values as in myStruct when I generate code using embedded coder.
What I seek is using variant subsystems and having some of tmp being in more than one variant with different values.
what shall I do?

채택된 답변

Mark McBroom
Mark McBroom 2019년 11월 9일
You might be able to do this by turning the contents of each variant sub-system into reference model and then setting up each reference model to use instance specific parameters. See this link:
  댓글 수: 1
Mahmoud Hassanien
Mahmoud Hassanien 2019년 11월 17일
I did somthing like what's in the link but when I generate code, the tmp structure isn't defined as a structure data type; myDT_tstrCalib as it should be. Instead, only the used elements are generated and the name of the structure is something that embedded coder creates on its own.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Component-Based Modeling에 대해 자세히 알아보기

제품


릴리스

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by