Hi Luca,
I'm testing STAPLE with the latest MATLAB R2025b and OpenSim 4.1. I encountered a runtime error during the femoral condyle extraction phase.
Error log:
Error using :
Colon operands must be real scalars.
Error in PCRegionGrowing (line 28)
Pts_Out(end+1:end+size(idx),:) = Pts(idx,:);
Cause:
In newer MATLAB versions (R2023a+), the colon operator strictly requires scalars. size(idx) returns a 1x2 vector (e.g., [N, 1]), which triggers this error.
Suggested Fix:
Changing size(idx) to length(idx) or size(idx, 1) on line 28 of PCRegionGrowing.m resolves the issue:
Pts_Out(end+1:end+length(idx),:) = Pts(idx,:);
Verified: replacing size() with length() fixes the crash and allows the model generation to continue.
Hi Luca,
I'm testing STAPLE with the latest MATLAB R2025b and OpenSim 4.1. I encountered a runtime error during the femoral condyle extraction phase.
Error log:
Cause:
In newer MATLAB versions (R2023a+), the colon operator strictly requires scalars. size(idx) returns a 1x2 vector (e.g., [N, 1]), which triggers this error.
Suggested Fix:
Changing
size(idx)tolength(idx)orsize(idx, 1)on line 28 of PCRegionGrowing.m resolves the issue:Pts_Out(end+1:end+length(idx),:) = Pts(idx,:);Verified: replacing size() with length() fixes the crash and allows the model generation to continue.