Main Content

sfpref

Set preferences for Stateflow charts

Description

example

allSettings = sfpref returns the Stateflow® preferences and settings.

example

setting = sfpref(preference) returns the setting for the specified preference.

example

setting = sfpref(ActionLanguage=actionLanguage) sets the default action language used by new Stateflow charts and state transition tables. For more information, see Change the Default Action Language.

example

setting = sfpref(PatternWizardCustomDir=customPatternFolder) sets the custom pattern folder used by the Pattern Wizard. For more information, see Save Custom Flow Chart Patterns.

example

setting = sfpref(EnableLabelAutoCorrectionForMAL=autoCorrection) enables or disables automatic correction of common C constructs in Stateflow charts that use MATLAB® as the action language. For more information, see Auto Correction When Using MATLAB as the Action Language.

example

setting = sfpref(ShowTransitionLabelOwner=transitionLabelLines) enables or disables indicator lines between transitions and associated labels.

Examples

collapse all

Display the settings for all Stateflow preferences.

sfpref
ans = 

  struct with fields:

                               ActionLanguage: 'MATLAB'
              EnableLabelAutoCorrectionForMAL: 1
                       PatternWizardCustomDir: ''
                     ShowTransitionLabelOwner: 0

Display the default action language used by new Stateflow charts and state transition tables.

sfpref("ActionLanguage")
ans =

    'MATLAB'

Change the default action language used by new Stateflow charts and state transition tables to C.

sfpref(ActionLanguage="C")
ans =

    'C'

Set the custom pattern folder used by the Pattern Wizard to C:\patterns.

sfpref(PatternWizardCustomDir=fullfile("C:","patterns"))
ans =

    'C:\patterns'

Disable automatic correction of common C constructs in charts that use MATLAB as the action language.

sfpref(EnableLabelAutoCorrectionForMAL=false)
ans =

    0

Display an indicator line between every transition and the associated label.

sfpref(ShowTransitionLabelOwner=true)
ans =

    1

Input Arguments

collapse all

Stateflow preference to return, specified as one of these values:

  • "ActionLanguage" — Default action language used by new Stateflow charts and state transition tables

  • "PatternWizardCustomDir" — Custom pattern folder used by the Pattern Wizard

  • "EnableLabelAutoCorrectionForMAL" — Whether Stateflow charts that use MATLAB as the action language automatically correct common C constructs

  • "ShowTransitionLabelOwner" — Whether indicator lines appear between transitions and associated labels

Default action language used by new Stateflow charts and state transition tables, specified as "MATLAB" or "C".

Custom pattern folder used by the Pattern Wizard, specified as a string scalar or character vector.

Data Types: string | char

Whether to enable automatic correction of common C constructs in Stateflow charts that use MATLAB as the action language, specified as a numeric or logical 1 (true) or 0 (false).

Whether to display the indicator lines between transitions and associated labels, specified as a numeric or logical 1 (true) or 0 (false), where:

  • true — Displays indicator lines for every transition

  • false — Displays indicator lines only when label ownership is unclear

Output Arguments

collapse all

Settings for all Stateflow preferences, returned as a structure with these fields:

  • ActionLanguage — Default action language used by new Stateflow charts and state transition tables, returned as 'MATLAB' or 'C'

  • PatternWizardCustomDir — Custom pattern folder used by the Pattern Wizard, returned as a character vector

  • EnableLabelAutoCorrectionForMAL — Whether Stateflow charts that use MATLAB as the action language automatically correct common C constructs, returned as 1 or 0 of data type double

  • ShowTransitionLabelOwner — Whether indicator lines appear between transitions and associated labels, returned as 1 or 0 of data type double

Setting for specified preference, returned in the format determined by the preference:

  • ActionLanguage'MATLAB' or 'C'

  • PatternWizardCustomDir — character vector

  • EnableLabelAutoCorrectionForMAL1 or 0 of data type double

  • ShowTransitionLabelOwner1 or 0 of data type double

Data Types: char | double

Version History

Introduced before R2006a