Unable to run the predict function
显示 更早的评论
Hi,
I have created a Model by training. Now I want to use the model for predicting. Property sheet shows me three menus: ModelName, ModelName.predictFcn and ModelName.HowtoPredict. ModelName.HowtoPredict showed me a line of text like:
yfit = C.predictFcn(T)
and some more text. I replaced the line to the following:
yfit = ModelName.predic(testdata);
but I am getting following errors:
run(GTM3_Acc62p8.HowToPredict);
Error using run (line 66)
yfit = GTM3_Acc62p8.predictFcn(testdata); not found.
Somebody please gide me.
Zulfi.
3 个评论
Zulfiqar Khan
2018-12-1
Walter Roberson
2018-12-1
GTM3_Acc62p8 appears to be a struct and GTM3_Acc62p8.HowToPredict appears to contain a character vector that appears to be in the form of a function call with an assignment to yfit. And you appear to be attempting to run(GTM3_Acc62p8.HowToPredict) and so appear to be attempting to run() a character vector that is a MATLAB statement.
run() is not used to execute MATLAB statements that are in character vectors or character arrays. run() must be provided with a file name (possibly qualified) and it causes the content of the file to be evaluated.
If you have a character vector that you want to execute, the MATLAB function is eval().
However, most of the time you should avoid eval() and instead create functions, possibly together with function handles.
Zulfiqar Khan
2018-12-1
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Install Products 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!