Question re Loren (on the Art of Matlab) Data Driven Fitiing

2 views (last 30 days)
Hi,
I´m using Loren's mylowess.m matlab code in MATLAB 2013a version. The thing is that I keep on getting the following error when I write exactly the same example that are on your post Data Driven Fitting:
Error using crossval>evalFun (line 480)
The function '@(train,test)norm(test(:,2)-mylowess(train,test(:,1),spans(j)))^2' generated the following error:
Undefined function or variable 'X'.
Error in crossval>getFuncVal (line 497)
funResult = evalFun(funorStr,arg(:));
Error in crossval (line 343)
funResult = getFuncVal(1, nData, cvp, data, funorStr, []);
Error in prueba_mylowess (line 60)
sse(j) = sum(crossval(f,[X,noisy],'partition',cp));
But when I use an older version of MATLAB (v.2011b) everything goes fine. Are there any changes in crossval code or in horzcat code?? why it is not working in the Matlab´s new version??
Waiting for your reply and thank you very much
Laura

Answers (2)

Bjorn Gustavsson
Bjorn Gustavsson on 30 Jan 2014
I managed to run through that example without problems in 2013a.

Sean de Wolski
Sean de Wolski on 30 Jan 2014
Run:
dbstop if error
And then run the erroring code. This will stop with the debugger on the offending line and you'll be able to see where you are which will help you identify why X is not defined.

Community Treasure Hunt

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

Start Hunting!