필터 지우기
필터 지우기

Is it possible to evaluate a variant control expression that contains a value inside a structure array?

조회 수: 2 (최근 30일)
To specify conditions for variant choices of a variant subsystem, I normally use a Simulink.Variant object such as
Simulink.Variant('Dev1SubsystemC_Option==2')
and then define Dev1SubsystemC_Option=1 or =2 or =3 in the workspace.
But because my current model is big and complicated, I need to put all parameters including variant settings within an organized structure. So instead of evaluating Dev1SubsystemC_Option in the base workspace, I tried to use
Simulink.Variant('Device(1).Subsystem_C.Option==2')
Error due to multiple causes.
Caused by:
'Device(1)' is not allowed as the left-hand side of 'Device(1).Subsystem_C' in variant condition expression
'Device(1).Subsystem_C.Option==2'. Only enumerated type names are allowed.
'Device(1).Subsystem_C' is not allowed as the left-hand side of 'Device(1).Subsystem_C.Option' in variant condition
expression 'Device(1).Subsystem_C.Option==2'. Only enumerated type names are allowed.
which gives me errors. I'm not sure why MATLAB doesn't want to accept this Boolean expression. Is there a way to work around this? I'm using MATLAB 2015a.
Thanks
  댓글 수: 2
JWiesemann
JWiesemann 2016년 8월 3일
Still no answer after more tha a year? Maybe "MATLAB Answers" is a misleading name.
Josh Chambers
Josh Chambers 2017년 2월 10일
편집: Josh Chambers 2017년 2월 10일
This is a pretty weird and serious limitation that I just ran into. Also, what the heck does it mean "Only enumerated type names are allowed"?? Also, please respond mathworks!
2016a here

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Variant Hierarchical Components에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by