Error with fillmissing syntax
Show older comments
Hello,
I have a simple 274x108 matrix A with numbers and NaNs.
I want to replace the Nans with interpolated values using fillmissing.
I would like to use the parameter 'MaxGap' — Maximum gap size to fill.
dim = 1;
[F,TF] = fillmissing(A,'linear',dim,'MaxGap',2);
No matter how I try to use it, it returns:
Error using fillmissing/parseInputs (line 455)
Fill method must be 'constant', 'previous', 'next', 'nearest', 'linear', 'spline', 'pchip',
'makima', 'movmean', or 'movmedian'.
How do you use the MaxGap parameter?
Thank you in advance!
Charles
6 Comments
dpb
on 9 Dec 2020
Which release are you using? 'MaxGap' was introduced after R2019b altho doc's don't provide when the more recent additions were let out. I'm guessing the release you have just doesn't know what the option is and so is getting confused in the parsing and the error message is best it can do.
Other than that, syntax looks ok although to go by column you don't need to specify the dimension so you might just try
[F,TF] = fillmissing(A,'linear','MaxGap',2);
for grins to make sure something else hasn't been buggered in the input parsing.
Farbos de Luzan
on 10 Dec 2020
I don't see anything wrong with this syntax.
Open fillmissing.m and place a break point at the line that checks the fillMethod against the validIntMethods, it should be at or very close to line 455 in 20a (line 505 in 20b). Then run your code and look at the value of fillMethod.
dpb
on 11 Dec 2020
Which release actually introduced 'MaxGap'?
Release notes for R2020b talk about it; it's not clear to me exactly what it means -- is this a behavior change or the introduction? Or is this just in the Live Editor? Pretty nebulous.
Surely wish TMW would also document in the doc these dates when new stuff is introduced besides just when the function itself was introduced.
fillmissing Function and Clean Missing Data Live Editor Task: Specify maximum gap size to fill
When filling missing data using the fillmissing function, you can use the 'MaxGap' name-value pair to fill only gaps of missing data up to a specified size. When using the Clean Missing Data Live Editor task, enter a gap size next to Max gap to fill.
Adam Danz
on 11 Dec 2020
MaxGap wasn't an option prior to r2020b
Here's documentation for 20a and that parameter isn't mentioned
Farbos de Luzan
on 11 Dec 2020
Accepted Answer
More Answers (1)
Farbos de Luzan
on 11 Dec 2020
Categories
Find more on Data Preprocessing 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!