Problem with network class variable on Matlab Function on Simulink
2 次查看(过去 30 天)
显示 更早的评论
Hello,
In my Simulink schematic I have a Matlab Function block, where I have written my code. In it, I use the function preparets, in an extrinsic way, defining it with coder.extrinsic('preparets').
net = load('NARX_CMON');
X = tonndata(up,true,false);
T = tonndata(yk',true,false);
[x,xi,ai] = preparets(net,X,{},T);
The problem arises when I load the neural network to a net variable, which I use in the preparets function. The error I get is the following:
"Found unsupported class for variable using function 'load'. MATLAB class 'network' found at 'net.net' is unsupported."
I understand that when converting the Matlab Function to C code for execution in Simulink, Simulink does not support Network class variables.
Since the C language does not support Network variables, how should I load the network to use it in the preparets function? what can I do to solve this problem? how can this be done?
0 个评论
回答(1 个)
Abhishek Kumar Singh
2024-2-23
编辑:Abhishek Kumar Singh
2024-2-24
Hi Haritz,
It looks like you're encountering limitations due to MATLAB Function blocks not supporting the direct use of certain MATLAB classes, such as network. Unfortunately, you cannot use the load function within a MATLAB Function block to load a neural network object.
For deep learning networks, MATLAB provides the coder.loadDeepLearningNetwork function, which is suitable for both simulation and deployment to standalone applications. However, please note that this function is intended for deep learning networks that are compatible with MATLAB Coder and may not support traditional neural networks from the Deep Learning Toolbox. For more information, you can refer to the following documentation resources:
An alternative approach for traditional neural networks is to generate a Simulink block using the gensim function, which can then be integrated into your main Simulink model. This method is particularly useful if you're working with networks created with the Deep Learning Toolbox. More details can be found on the following documentation page:
If your network is a traditional feedforward or recurrent neural network from the Deep Learning Toolbox, you might need to pass the network object as an input parameter to the MATLAB Function block from the workspace, avoiding the use of the load function inside the block.
I 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!