matlab工具箱生成的函数怎么使用

我用神经网络工具箱生成了一个函数myNeuralNetworkFunction。我怎么能在其他程序中调用这个函数?提示没有traningdata,这个怎么设置?急求解答,万分感谢!

function [Y,Xf,Af] = myNeuralNetworkFunction(X,~,~)
%MYNEURALNETWORKFUNCTION neural network simulation function.
%
% Auto-generated by MATLAB, 26-Apr-2021 04:22:18.
%
% [Y] = myNeuralNetworkFunction(X,~,~) takes these arguments:
%
%   X = 1xTS cell, 1 inputs over TS timesteps
%   Each X{1,ts} = Qx4 matrix, input #1 at timestep ts.
%
% and returns:
%   Y = 1xTS cell of 1 outputs over TS timesteps.
%   Each Y{1,ts} = Qx1 matrix, output #1 at timestep ts.
%
% where Q is number of samples (or series) and TS is the number of timesteps.

%#ok<*RPMT0>

% ===== NEURAL NETWORK CONSTANTS =====

% Input 1
x1_step1.xoffset = [0.89;0.426;0;0];
x1_step1.gain = [0.000260593789007633;0.623052959501558;2;2];
x1_step1.ymin = -1;

% Layer 1
b1 = [-2.972106908868368258;-1.4604485901691530714;1.8986136988210191578;0.24367788546230539914;-0.11297543570694483506;1.1375273297071077927;1.376291127981477791;-1.8135855166159384755;-2.5712826761605191983;1.9832620648305914202];
IW1_1 = [0.16184022503577202845 -1.8683506677327388346 1.4771606093505988966 -0.28713074187747039678;1.0731222109563014477 -1.2949721694866531685 -1.4662837994650614881 0.32209732277109243137;0.75654719069241171958 1.3716275988027939459 -1.7008568676638655681 -0.9664882818780873297;1.9131735760684571712 -2.6165873615665939944 -2.5298687482121451353 2.2322316890427558178;1.2956762325919928269 -3.0356758924590629967 -1.5173356420950063761 4.4024160182349705295;3.6276959895465519246 2.4595414265798263287 -2.1020020231372740227 -1.4067168713182824913;-0.054893009902333832206 -1.4247317956729816935 -1.5536166333160497111 -1.4315760244569599724;1.0460221350487701741 1.5270053994325945013 1.9190444018121921577 1.1055116709074677139;-2.8829772955537915635 1.0123421788371129715 -2.4026764370513085112 -1.715179189610481103;1.1136018547849166893 1.3242620432305094447 1.9798607772885765677 0.17228435316879242567];

% Layer 2
b2 = -0.59414725891687703019;
LW2_1 = [1.5532277604384117087 0.48972532023867265671 1.8422238427915964554 0.25533793305082286285 -0.050283923852910153429 0.0124410507324608198 1.376620116325962373 1.1069032165817329627 0.0037934147119184601082 0.80525611165260357893];

% Output 1
y1_step1.ymin = -1;
y1_step1.gain = 0.000713872687944832;
y1_step1.xoffset = 6.04;

% ===== SIMULATION ========

% Format Input Arguments
isCellX = iscell(X);
if ~isCellX
    X = {X};
end

% Dimensions
TS = size(X,2); % timesteps
if ~isempty(X)
    Q = size(X{1},1); % samples/series
else
    Q = 0;
end

% Allocate Outputs
Y = cell(1,TS);

% Time loop
for ts=1:TS
    
    % Input 1
    X{1,ts} = X{1,ts}';
    Xp1 = mapminmax_apply(X{1,ts},x1_step1);
    
    % Layer 1
    a1 = tansig_apply(repmat(b1,1,Q) + IW1_1*Xp1);
    
    % Layer 2
    a2 = repmat(b2,1,Q) + LW2_1*a1;
    
    % Output 1
    Y{1,ts} = mapminmax_reverse(a2,y1_step1);
    Y{1,ts} = Y{1,ts}';
end

% Final Delay States
Xf = cell(1,0);
Af = cell(2,0);

% Format Output Arguments
if ~isCellX
    Y = cell2mat(Y);
end
end

% ===== MODULE FUNCTIONS ========

% Map Minimum and Maximum Input Processing Function
function y = mapminmax_apply(x,settings)
y = bsxfun(@minus,x,settings.xoffset);
y = bsxfun(@times,y,settings.gain);
y = bsxfun(@plus,y,settings.ymin);
end

% Sigmoid Symmetric Transfer Function
function a = tansig_apply(n,~)
a = 2 ./ (1 + exp(-2*n)) - 1;
end

% Map Minimum and Maximum Output Reverse-Processing Function
function x = mapminmax_reverse(y,settings)
x = bsxfun(@minus,y,settings.ymin);
x = bsxfun(@rdivide,x,settings.gain);
x = bsxfun(@plus,x,settings.xoffset);
end

 

不知道你这个问题是否已经解决, 如果还没有解决的话:

如果你已经解决了该问题, 非常希望你能够分享一下解决方案, 以帮助更多的人 ^-^