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!