Argument to dynamic structure reference must evaluate to a valid field name (helperBluetoothChannelClassification)

Viewed 11

Hi im doing a bluetooth project using bluetooth toolbox in matlab, and encountered a problem. So I have been following one of the example from https://www.mathworks.com/help/bluetooth/ug/noncollaborative-bluetooth-le-coexistence-with-wlan-signal-interference.html this error occurred.

ble_wlan_interference

Argument to dynamic structure reference must evaluate to a valid field name.

Error in helperBluetoothChannelClassification (line 102) obj.(varargin{idx}) = varargin{idx+1};

Error in ble_wlan_interference (line 58) classifierObj = helperBluetoothChannelClassification(centralNode,peripheralNode,PERThreshold=50);

At line 102 of helperBluetoothChannelClassification.m is as follows,

methods
    % Constructor
    function obj = helperBluetoothChannelClassification(varargin)
        % Set name-value pairs
        for idx = 1:2:nargin
            obj.(varargin{idx}) = varargin{idx+1};
        end

At line 58 of main code is as follows,

%enable channel classification
enableChannelClassification = true;
if enableChannelClassification 
    classifierObj = helperBluetoothChannelClassification(centralNode,peripheralNode,PERThreshold=50);     
    classifyFcn = @(varargin) classifierObj.classifyChannels;
    userData = [];                                                            % User data needed to be passed to the callback function
    callAt = 0;                                                               % Absolute simulation time, in seconds
    periodicity = 125e-3;                                                     % In seconds
    
    scheduleAction(networkSimulator,classifyFcn,userData,callAt,periodicity); % Schedule channel classification
end

I think the centralNode and peripheralNode parameter is not recognizable in helperBluetoothChannelClassification function, but don't know what is a problem.. Thanks :)

0 Answers
Related