Is there a way to programmatically get list of valid values/datatypes for Simulink block parameter?

11 visualizaciones (últimos 30 días)
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?
For example, Delay dialog box parameters 'ShowEnablePort' which can only be set to 'on' or 'off'.

Respuestas (1)

Paul
Paul el 13 de Oct. de 2021
Editada: Paul el 13 de Oct. de 2021
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.

Categorías

Más información sobre Simulink Environment Customization en Help Center y File Exchange.

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by