Skip to content

Commit 7cafa20

Browse files
HanSur94claude
andcommitted
fix(FastSense): handle single-point thresholds in addSensor
When a resolved threshold has only 1 point (e.g. from a single-state condition), addThreshold misinterpreted it as scalar form because numel(X) <= 1. Use the scalar addThreshold(value, ...) form for single-point thresholds to avoid passing Y as a name-value key. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 03faeeb commit 7cafa20

1 file changed

Lines changed: 17 additions & 6 deletions

File tree

libs/FastSense/FastSense.m

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -575,12 +575,23 @@ function addSensor(obj, sensor, varargin)
575575
thLabel = sprintf('Threshold %d', i);
576576
end
577577
[thColor, thStyle] = obj.resolveThresholdStyle(th.Color, th.LineStyle);
578-
obj.addThreshold(th.X, th.Y, ...
579-
'Direction', th.Direction, ...
580-
'ShowViolations', true, ...
581-
'Label', thLabel, ...
582-
'Color', thColor, ...
583-
'LineStyle', thStyle);
578+
if numel(th.X) <= 1
579+
% Single-point or scalar — use scalar form
580+
thVal = th.Y(1);
581+
obj.addThreshold(thVal, ...
582+
'Direction', th.Direction, ...
583+
'ShowViolations', true, ...
584+
'Label', thLabel, ...
585+
'Color', thColor, ...
586+
'LineStyle', thStyle);
587+
else
588+
obj.addThreshold(th.X, th.Y, ...
589+
'Direction', th.Direction, ...
590+
'ShowViolations', true, ...
591+
'Label', thLabel, ...
592+
'Color', thColor, ...
593+
'LineStyle', thStyle);
594+
end
584595
end
585596
end
586597
end

0 commit comments

Comments
 (0)