Skip to content

Commit

Permalink
Addressed issue #6 for edge case in source code file smoothmedian.cpp
Browse files Browse the repository at this point in the history
Addressed issue #6 for edge case described in the link below in source code file smoothmedian.cpp:
gnu-octave#6
At the time of this commit, this minor bug fix has not been incorporated yet into the pre-compiled binary files.
  • Loading branch information
acp29 committed Feb 9, 2025
1 parent 22bc2f0 commit 4187283
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/smoothmedian.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@ void mexFunction (int nlhs, mxArray* plhs[],
// Omit NaN values and calculate the length of the resulting vector
xvec.erase (remove_if (xvec.begin(), xvec.end(), mxIsNaN), xvec.end());
l = xvec.size ();
if (l == 0) {
M[k] = NAN;
break;
}

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

0 comments on commit 4187283

Please sign in to comment.