How to initialize the class in MATALB?
1 次查看(过去 30 天)
显示 更早的评论
I want to use 'fitrgp' function in Matlab Simulink.
fitrgp returns a GPmodel and its type of class is 'RegressionGP'.
for example:
y=fitrgp(rand(100,2),rand(100,1));
class(y)
ans =
'RegressionGP'
i used the matlab function block in MATLAB simulink and used the following code
function y = fcn()
coder.extrinsic('fitrgp');
y=fitrgp(rand(100,2),rand(100,1));
it gives me following error and recommends me to preinitialize the output.
Function output 'y' cannot be an mxArray in this context. Consider
preinitializing the output variable with a known type
how can i preinitialize this 'RegressionGP' class so that i can use 'fitrgp' command in MATLAB Simulink?
2 个评论
Wooshik Kim
2018-7-5
you can try initializing y
what is the output of fitrgp?
if it is an array, initialize y with an array of the same size
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!