How to call neural network .mat file during the Simulink simulation?
2 次查看(过去 30 天)
显示 更早的评论
Hi,
I have made an neural network model by using 'fitnet' function in Matlab and saved it as 'ANN2.mat'
In my simulink model, I would like to use this nn model to predict an output. (the simulink model is expressed below)
What I have done is put a 'm-function' and script is like this:
function y = fcn(Tset, Tsa, Tra, Qair, dT_w)
load ANN2
input = [Tset, Tsa, Tra, Qair, dT_w]'
output = net(input)
y = output;
But an error occurs:
As I don't know much about matlab & simulink, it is hard for me to understand the error and how to solve.
What is wrong with my script?
Is there any method to import my neural network model as .m or .mat file and execute it?
Because I'm trying to train nn model with new data which is generated by every simulink timestep, I want to avoid using blocks supporting from simulink.
Thank you very much in advance for your time.
1 个评论
回答(1 个)
Harsha Priya Daggubati
2020-7-27
Hi,
I guess the error might be because of using 'net'. Since you saved the network as ANN2 you need to use ANN2(input) instead of net.
You can also look at the following link for a list of options available to use Simulink to train a neural network:
Hope this helps!
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Sequence and Numeric Feature Data Workflows 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!