error calling a neural network function after m-file is compiled as a .NET library

2 次查看(过去 30 天)
I have a prediction model in the form of a trained neural network, which I load and use with a 3x1 vector input. It works fine in the .m file. Then I compile the .m file using the library compiler and I access the dll file through a C# application and I get an error when it tries to call a prediction from the neural network model.
It is not the format of the input, as I can succesfully take in vectors manipulate them and get them back again in any compiled .m file as a .NET library, but I cannot call the neural network function in the .NET library. Not even if I use a constant vector I created in the .m file. So to sum up; it works as an .m file but as soon as I compile it, it stops working.
The affected code in Visual Studio:
The affecting code in m_SU_column:
Error code:
… MWMCR::EvaluateFunction error …
Array indices must be positive integers or logical values.
Error in => m_SU_column.m at line 61.
If anyone have any idea, it would be greatly appreciated, as I have tried everything I can think of.

回答(1 个)

Himanshu
Himanshu 2023-10-13
Hey Lasse,
I understand that you are trying to pass the input_vec as an index to the net_column_price array, which is the reason you are encountering the error. As the error indicates, you can only pass positive integers and logical values to MATLAB arrays as indices.
Please refer to the following link for detailed documentation about array indexing:
Hope it helps,
Thanks and Regards,
Himanshu

类别

Help CenterFile Exchange 中查找有关 MATLAB Compiler SDK 的更多信息

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by