Setplspref

From Eigenvector Research Documentation Wiki
Revision as of 13:24, 7 October 2008 by imported>Jeremy
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Purpose

Set overriding options (preferences) for PLS_Toolbox functions.

Synopsis

setplspref(mfile,options)
setplspref(mfile,option,value)
setplspref(mfile,'factory') %reset preferences for specified file
setplspref('factory') %reset all preferences to factory settings

Description

Sets user-defined "overriding default options" for a PLS_Toolbox function. These preferences will, for a given function, override any factory-default options of the same name. Any option which is defined in the factory-defaults but not specified in the user-defined default options will remain at the factory-default setting.

Although many PLS_Toolbox functions permit you to modify their default behavior by passing an options structure (see FAQ item on using Options Structures), you can also change the default value for any option in any function using setplspref.

By specifying a new default options value, the desired behavior can be achieved with a function without passing any options structure. These settings are remembered from one Matlab session to another. This is very useful to semi-permanently change the default behavior of any function without having to continually specify an options structure each time the function is called.

The keyword 'factory' can be used to reset all or some of the options back to the factory default values: When given as the mfile name (mfile) then all preferences for all functions will be reset; when given as the options structure (options), then all options for the named function will be reset. When given as the value for a specified option, only that option's default is reset.

See below for other input forms.

Inputs

  • mfile = the function name for which preferences are being set.

The subsequent inputs can be one of three forms:

  • Form 1:
    • options = a structure to use as the overriding default options forthe given function. Any previous overriding options are erased.
  • Form 2:
    • option = a string defining the option to set. Any other overriding options for this mfile are left alone and only that one option is changed.
    • value = a value for the particular option
  • Form 3:
    • option = a string defining the option to set. Any other overriding options for this mfile are left alone and only that one option is changed.
    • 'factory' = the string 'factory' resets the speicified option to the factory default.

Examples

To turn off the default plotting or display functionality of a function. The following command will disable the plots which are automatically provided by PCA:

 setplspref('pca','plots','none')

We can test that the option is changed by retrieving the options from PCA.

>> options=pca('options')
options = 
            name: 'options'
         display: 'on'
           plots: 'none'
   outputversion: 3
   preprocessing: {[]}
    blockdetails: 'standard'

Several options can be set at once using a structure:

options = []; 
options.plots = 'none'; 
setplspref('pca',options)

To reset one option to its factory default, use the keyword 'factory' as the value for the given option:

 setplspref('pca','plots','factory')  %reset 'plots' option for PCA

To reset all options values for a given function to the factory defaults, call setplspref with the function name and the keyword 'factory'.

 setplspref('pca','factory')   %reset all options for PCA

To reset all options values for all functions to the factory defaults, call setplspref with keyword 'factory' alone. Warning: this will erase ALL user-defined defaults.

 setplspref('factory')

See Also

getplspref