Skip to content

Fix size() used as loop bound in parameter parsing - #1

Open
jindonut wants to merge 1 commit into
braindynamicslab:masterfrom
jindonut:fix-size-loop-bound
Open

Fix size() used as loop bound in parameter parsing#1
jindonut wants to merge 1 commit into
braindynamicslab:masterfrom
jindonut:fix-size-loop-bound

Conversation

@jindonut

@jindonut jindonut commented Aug 7, 2026

Copy link
Copy Markdown

size(x) called without a dimension argument returns a dimension vector rather
than a scalar. Used as a colon operand in for i = 1:size(x), this errors under
R2026a: "Colon operands must be real scalars."

Replaced with numel() in four places:

  • parse_mappers.m line 3
  • run_main.m lines 213 and 253
  • run_preprocess.m line 50

numel() returns the total element count as a scalar, which is the intended
loop bound in each case.

Found all four occurrences by regex; no others exist in code/:

grep -rnoE "[0-9a-zA-Z_]+:size\([A-Za-z_.]+\)" --include="*.m" code/

size() with no dimension argument returns a dimension vector, which is invalid as a colon operand. Replaced with numel() in four locations: parse_mappers.m line 3, run_main.m lines 213 and 253, run_preprocess.m line 50.
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.

1 participant