Skip to content

Commit 4187283

Browse files
committed
Addressed issue #6 for edge case in source code file smoothmedian.cpp
Addressed issue #6 for edge case described in the link below in source code file smoothmedian.cpp: #6 At the time of this commit, this minor bug fix has not been incorporated yet into the pre-compiled binary files.
1 parent 22bc2f0 commit 4187283

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/smoothmedian.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,10 @@ void mexFunction (int nlhs, mxArray* plhs[],
166166
// Omit NaN values and calculate the length of the resulting vector
167167
xvec.erase (remove_if (xvec.begin(), xvec.end(), mxIsNaN), xvec.end());
168168
l = xvec.size ();
169+
if (l == 0) {
170+
M[k] = NAN;
171+
break;
172+
}
169173

170174
// Set the (ordinary) median as the starting value
171175
mid = 0.5 * l;

0 commit comments

Comments
 (0)