Skip to content

Fix rmmissing empty input validation - #502

Merged
pr0m1th3as merged 1 commit into
gnu-octave:mainfrom
sahilphad07-sudo:fix-rmmissing-empty-validation
Sep 24, 2026
Merged

pr0m1th3as merged 1 commit into
gnu-octave:mainfrom
sahilphad07-sudo:fix-rmmissing-empty-validation

Conversation

@sahilphad07-sudo

@sahilphad07-sudo sahilphad07-sudo commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

rmmissing returned early for empty inputs before validating optional arguments. As a result, invalid MinNumMissing, MissingLocations, and DIM values were silently accepted for empty inputs, unlike MATLAB.

This change moves empty-input handling after argument validation so invalid arguments are rejected consistently.

Before

octave:> rmmissing([], 'MinNumMissing', -2)
ans =

[](0x0)

After

octave:> rmmissing([], 'MinNumMissing', -2)
error: rmmissing: 'MinNumMissing' must be a positive integer value.

MATLAB Behavior

>> rmmissing([], 'MinNumMissing', -2)
Error: 'MinNumMissing' value must be a nonnegative integer.

Regression Tests Added

  • Invalid MinNumMissing
  • Invalid DIM
  • Invalid MissingLocations

Test Results

All existing and new rmmissing BISTs pass:

@pr0m1th3as
pr0m1th3as merged commit fc84595 into gnu-octave:main Sep 24, 2026
8 checks passed
pr0m1th3as added a commit that referenced this pull request Sep 24, 2026
… follow-up to #502.

  * inst/Data_Manipulation/rmmissing.m: drop the early return for empty
  input, so TF has one element per row or column; accept MinNumMissing
  0; count missing values per element on a vector, so a value above 1
  removes nothing, as MATLAB does; update the help text; add tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants