possible to overload function in matlab class?

后端 未结 1 655
遥遥无期
遥遥无期 2021-02-09 03:34

Is it possible to overload a function in a Matlab class that you\'ve created?

Like the following:

    function [ sigma_nc ] = sustained_interference( N )         


        
相关标签:
1条回答
  • 2021-02-09 03:35

    If you create the function using the latter, then you can pass it just a single parameter which will be interpreted as the first. If you want default values, then you can do something like this:

    function [ sigma_nc ] = sustained_interference( N, center_freq )
       if nargin < 2
           center_freq = N.center_freq;
       end
       ...
    end
    
    0 讨论(0)
提交回复
热议问题