Skip to content

Commit 6169ab0

Browse files
committed
make indexing on the matlab side start with 1, changed tests
1 parent e15180f commit 6169ab0

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

+nix/SampledDimension.m

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
end
2525

2626
function posAt = position_at(obj, index)
27+
if index > 0
28+
index = index - 1;
29+
end
2730
func_name = strcat(obj.alias, '::position_at');
2831
posAt = nix_mx(func_name, obj.nix_handle, uint64(index));
2932
end
@@ -32,7 +35,9 @@
3235
if nargin < 3
3336
startIndex = 0;
3437
end
35-
38+
if startIndex > 0
39+
startIndex = startIndex - 1;
40+
end
3641
func_name = strcat(obj.alias, '::axis');
3742
axis = nix_mx(func_name, obj.nix_handle, uint64(count), uint64(startIndex));
3843
end

tests/TestDimensions.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
assert(axis(end) == (length(axis) - 1) * d1.samplingInterval + d1.offset);
6464

6565
assert(d1.position_at(0) == d1.offset);
66-
assert(d1.position_at(9) == d1.offset + 9 * d1.samplingInterval);
66+
assert(d1.position_at(10) == d1.offset + 9 * d1.samplingInterval);
6767

6868
d1.label = '';
6969
d1.unit = '';
@@ -79,7 +79,7 @@
7979
assert(axis(end) == (length(axis) - 1) * d1.samplingInterval + d1.offset);
8080

8181
assert(d1.position_at(0) == d1.offset);
82-
assert(d1.position_at(9) == d1.offset + 9 * d1.samplingInterval);
82+
assert(d1.position_at(10) == d1.offset + 9 * d1.samplingInterval);
8383
end
8484

8585
function [] = test_range_dimension( varargin )

0 commit comments

Comments
 (0)