Using fit function ignoring NaN

144 views (last 30 days)
Paola
Paola on 17 Mar 2022
Commented: Paola on 20 Mar 2022
Hi,
how can I use the fit function ignoring the NaN values in my y vector?
Thanks
  1 Comment
Torsten
Torsten on 17 Mar 2022
By removing them before calling the fit function.

Sign in to comment.

Accepted Answer

Matt J
Matt J on 17 Mar 2022
include=~isnan(y);
fobj = fit(x(include),y(include),fitType)

More Answers (0)

Community Treasure Hunt

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

Start Hunting!