Main Content

rmvar

(Removed) Remove variables from fuzzy inference system

    rmvar has been removed. Use removeInput or removeOutput instead. For more information, see Version History.

    Description

    outfis = rmvar(infis,varType,varIndex) removes the input or output variable with the specified index from the fuzzy system infis.

    This command automatically alters the rule list to keep its size consistent with the current number of variables. You must delete from the FIS any rule that contains a variable you want to remove before removing it. You cannot remove a fuzzy variable currently in use in the rule list.

    example

    [outfis,errorStr] = rmvar(___) returns any errors as a character vector.

    Examples

    collapse all

    Create a fuzzy inference system.

    fis = newfis('mysys');

    Add an input variable with a single membership function to the system.

    fis = addvar(fis,'input','temperature',[0 100]);
    fis = addmf(fis,'input',1,'cold','trimf',[0 30 60]);

    View the variable properties.

    getfis(fis,'input',1)
    ans = struct with fields:
          Name: 'temperature'
        NumMFs: 1
           mf1: 'cold'
         range: [0 100]
    
    

    Remove the membership function. To do so, remove membership function 1 from input 1.

    fis = rmmf(fis,'input',1,'mf',1);

    View the variable properties.

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

    The variable now has no membership function.

    Input Arguments

    collapse all

    Fuzzy system, specified as a FIS object.

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

    Variable index, specified as a positive integer.

    Output Arguments

    collapse all

    Updated fuzzy system, returned as a FIS object.

    Error messages, returned as a character vector.

    Version History

    Introduced before R2006a

    expand all

    R2024b: Removed

    rmvar has been removed. To remove input or output variables from a fuzzy system, use removeInput or removeOutput, respectively.

    This table shows some typical usages of rmvar and how to update your code to use removeInput or removeOutput instead. Previously, you specified the index of the variable that you wanted to remove. Now, to remove a variable, specify the variable name.

    If your code has this form:Use this code instead:
    fis = rmvar(fis,'input',1)
    fis = removeInput(fis,"service")
    fis = rmvar(fis,'output',1)
    fis = removeOutput(fis,"tip")

    Previously, you had to delete any rules from your fuzzy system that contained the variable you wanted to remove. removeInput and removeOutput automatically remove these variables from the rule set of your fuzzy system.