Is there a way to programmatically get list of valid values/datatypes for Simulink block parameter?
조회 수: 11 (최근 30일)
이전 댓글 표시
Simulink Block Specific parameters documentation lists the values and/or datatype each parameter of the block accept. Is there an api or function that allows us to get this information programmatically?
댓글 수: 0
답변 (1개)
Paul
2021년 10월 13일
편집: Paul
2021년 10월 13일
I'm not sure that this can be done in general. But for dialog parameters that areof type 'enum', the options can be obtained by:
>> d=get_param(gcb,'DialogParameters')
d =
struct with fields:
DelayLengthSource: [1×1 struct]
DelayLength: [1×1 struct]
DelayLengthUpperLimit: [1×1 struct]
InitialConditionSource: [1×1 struct]
InitialCondition: [1×1 struct]
ExternalReset: [1×1 struct]
ShowEnablePort: [1×1 struct]
PreventDirectFeedthrough: [1×1 struct]
DiagnosticForDelayLength: [1×1 struct]
RemoveDelayLengthCheckInGeneratedCode: [1×1 struct]
InputProcessing: [1×1 struct]
UseCircularBuffer: [1×1 struct]
SampleTime: [1×1 struct]
StateName: [1×1 struct]
StateMustResolveToSignalObject: [1×1 struct]
StateSignalObject: [1×1 struct]
StateStorageClass: [1×1 struct]
CodeGenStateStorageTypeQualifier: [1×1 struct]
>> d.DelayLengthSource
ans =
struct with fields:
Prompt: 'Delay length source:'
Type: 'enum'
Enum: {'Dialog' 'Input port'}
Attributes: {'read-write' 'read-only-if-compiled' 'dont-eval' 'link-instance'}
>> d.DelayLengthSource.Enum
ans =
1×2 cell array
{'Dialog'} {'Input port'}
For parameters of type 'boolean', I'll just conjecture that the choices are either 'on' or 'off'.
For parameters of type 'string' I don't know what to say:
>> d.DelayLength
ans =
struct with fields:
Prompt: 'Delay length:'
Type: 'string'
Enum: {}
Attributes: {'read-write' 'read-only-if-compiled' 'link-instance'}
I don't know and couldn't find in doc if there are any other types of dialog parameters.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Simulink Environment Customization에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!