How to use of 'prediction block' in Simulink

14 views (last 30 days)
Gang Gyoo Jin
Gang Gyoo Jin on 20 Sep 2025 at 11:01
Commented: AJ Ibraheem on 6 Oct 2025 at 13:14
% One-dimension data was generated and the tranined net was save to 'TrainedNetwork_for_Simulation.mat'
% Generate data
t = 0:0.1:50;
y = sin(t) + 0.1 * randn(size(t));
% Train the network
net= feedforwardnet;
net = train(net,t,y);
% Save the trained network
save('TrainedNetwork_for_simulink', 'net');
% I'm trying to use a trained network in a Simulink model(TestPredict.slx), but I'm getting an error. The error message indicates that
% Error in 'TestPredict/Predict': Failed to evaluate mask initialization commands.
% Caused by:
% MAT file TrainedNetwork_for_simulink.mat does not contain a valid SeriesNetwork, DAGNetwork, dlnetwork, yolov2ObjectDetector or an %% % ssdObjectDetector object.
  1 Comment
AJ Ibraheem
AJ Ibraheem on 6 Oct 2025 at 13:14
The 'Predict' block does not support the network type that you've trained.
Try training your network using trainnet instead, see https://uk.mathworks.com/help/deeplearning/ref/trainnet.html

Sign in to comment.

Answers (0)

Categories

Find more on Sequence and Numeric Feature Data Workflows in Help Center and File Exchange

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!