Main Content

addvar

(Removed) Add variable to fuzzy inference system

    addvarhas been removed. Use addInput or addOutput instead. For more information, see Version History.

    Description

    outfis = addvar(infis,varType,varName,varRange) adds an input or output variable to the fuzzy system infis with the specified name and range.

    Indices are applied to variables in the order in which they are added. For example, the first input variable added to a system is input variable number one for that system. Input and output variables are numbered independently.

    example

    Examples

    collapse all

    Create a new FIS.

    fis = newfis('tipper');

    Add a new input variable.

    fis = addvar(fis,'input','service',[0 10]);

    View new variable properties.

    getfis(fis,'input',1)
    ans = struct with fields:
          Name: 'service'
        NumMFs: 0
         range: [0 10]
    
    

    Input Arguments

    collapse all

    Fuzzy system, specified as a FIS object.

    Variable type, specified as either 'input' or 'output'.

    Variable name, specified as a string or character vector.

    Variable range, specified as a two-element vector, where the first element is the minimum value and the second element is the maximum value for the variable.

    Output Arguments

    collapse all

    Updated fuzzy system, returned as a FIS object.

    Version History

    Introduced before R2006a

    expand all

    R2024b: Removed

    addvar has been removed. To add input or output variables to a fuzzy system, use addInput or addOutput, respectively.

    This table shows some typical usages of addvar and how to update your code to use addInput or addOutput instead.

    If your code has this form:Use this code instead:
    fis = addvar(fis,'input',...
                 'service',[0 10])
    fis = addInput(fis,[0 10],...
                   'Name',"service")
    fis = addvar(fis,'output',...
                 'tip',[0 30])
    fis = addOutput(fis,[0 30],...
                    'Name',"tip")