NEED HELP URGENTLY WITH COMPILE RUN ERROR

Hi guys.
Why does this code not want to generate the function? The neural net runs perfectly, but I need to generate a MatrixOnly function for the C coder, and it wont compile? Any ideas? TIAMATLAB HELP NEEDED.jpg

6 件のコメント

Adam
Adam 2019 年 10 月 24 日
Also, posting a screenshot of code is not useful, especially when your error is on line 36 and the screenshot ends at line 35!
Sheldon Nyce
Sheldon Nyce 2019 年 10 月 24 日
% Solve an Input-Output Fitting problem with a Neural Network
% Script generated by NFTOOL
%
% This script assumes these variables are defined:
%
% houseInputs - input data.
% houseTargets - target data.
clc;
inputs = transpose(TrainingdataforMATLABInput);
targets = transpose(TrainingdataforMATLABOutput);
% Create a Fitting Network
hiddenLayerSize = [10 10];
net = fitnet(hiddenLayerSize);
% Set up Division of Data for Training, Validation, Testing
net.divideParam.trainRatio = 70/100;
net.divideParam.valRatio = 15/100;
net.divideParam.testRatio = 15/100;
net.trainFcn = 'trainlm';
% Train the Network
[net,tr] = train(net,inputs,targets);
% Test the Network
outputs = net(inputs);
errors = gsubtract(outputs,targets);
performance = perform(net,targets,outputs)
% View the Network
view(net)
genFunction(net,'C:\Users\27714\Desktop\Neural Network training\myNetwork.m','MatrixOnly');
% Plots
% Uncomment these lines to enable various plots.
% figure, plotperform(tr)
% figure, plottrainstate(tr)
% figure, plotfit(targets,outputs)
% figure, plotregression(targets,outputs)
% figure, ploterrhist(errors)
Sheldon Nyce
Sheldon Nyce 2019 年 10 月 24 日
編集済み: Steven Lord 2019 年 10 月 24 日
%genFunction code
[SL: Please do not post the text of functions from MathWorks products. Removing the code of the genFunction function from Neural Network Toolbox.]
Sheldon Nyce
Sheldon Nyce 2019 年 10 月 24 日
Also, do not attempt to correct me - this is urgent. I will read the article, but I need to fix this problem as fast as is humanly possible. If you could please help, I would really appreciate the assistance.
Adam
Adam 2019 年 10 月 24 日
All questions are urgent to the people asking them. People answering them will often ignore those who use capital letters and words like 'urgent' though. So if you want a fast answer you would do far better not to use them.
Sheldon Nyce
Sheldon Nyce 2019 年 10 月 24 日
Noted, thanks for the input. Will approach differently in future.

サインインしてコメントする。

 採用された回答

Steven Lord
Steven Lord 2019 年 10 月 24 日
編集済み: Steven Lord 2019 年 10 月 24 日

0 投票

Looking at your genFunction call:
genFunction(net,'C:\Users\27714\Desktop\Neural Network training\myNetwork.m', ...
'MatrixOnly');
the help text lists the following syntax:
genFunction(...,'MatrixOnly','yes')
Try adding in the 'yes' at the end of the call.
genFunction(net,'C:\Users\27714\Desktop\Neural Network training\myNetwork.m', ...
'MatrixOnly', 'yes');

1 件のコメント

Sheldon Nyce
Sheldon Nyce 2019 年 10 月 28 日
Thank you very much for the help!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeDeep Learning Toolbox についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by