Keep getting this polyfit error and don't know how to fix, error using polyfit "the first two inputs must have the name number of elements"
Show older comments
JobSector = app.JobSectorsInSolarDropDown.Value;
switch JobSector
case 'Installation & Project Development'
hold(app.UIAxes, "off")
plot(app.UIAxes,app.xyears,app.yipd,'ob')
%ployfit- provies coefficients for the regression
%equation
IPDcoef= polyfit(app.xyears,app.yipd,1);
%IPDcoef= [m,b]
m= IPDcoef(1);
b= IPDcoef(2);
%function handle
IPDFUNC= @(x) m*x+b;
%regression equation
hold(app.UIAxes,"on")
fplot(app.UIAxes,IPDFUNC,[min(app.xyears),max(app.xyears)],'-r')
end
%error i get in command window
%Error using polyfit (line 49)
%The first two inputs must have the same number of elements.
%Error in SolarAppGG/JobSectorsInSolarDropDownValueChanged (line 57)
%IPDcoef= polyfit(app.xyears,app.ymanu,1);
%Error in %matlab.apps.AppBase>@(source,event)executeCallback(ams,app,callback,requiresEventData,ev%ent) (line 62)
% newCallback = @(source, event)executeCallback(ams, ...
%Error while evaluating DropDown PrivateValueChangedFcn.
Accepted Answer
More Answers (0)
Categories
Find more on Creating, Deleting, and Querying Graphics Objects in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!