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!