Skip to content

Commit 0689743

Browse files
committed
Fixed a bug, where referencing trailing unitary dimensions would fail (@marcsous).
1 parent 8414119 commit 0689743

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

MappedTensor.m

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1827,6 +1827,9 @@ function mt_write_all(hDataFile, vnTensorSize, strClass, nHeaderBytes, tData, ~)
18271827

18281828
% ConvertColonCheckLims - FUNCTION Convert colon referencing to subscript indices; check index limits
18291829
function [vnLinearIndices, vnDataSize] = ConvertColonsCheckLims(cRefs, vnLims, hRepSumFunc)
1830+
% - Fill trailing referenced dimension limits
1831+
vnLims(end+1:numel(cRefs)) = 1;
1832+
18301833
% - Handle linear indexing
18311834
if (numel(cRefs) == 1)
18321835
vnLims = prod(vnLims);
@@ -1873,6 +1876,9 @@ function mt_write_all(hDataFile, vnTensorSize, strClass, nHeaderBytes, tData, ~)
18731876
% - Find colon references
18741877
vbIsColon = cellfun(@iscolon, cRefs);
18751878

1879+
% - Fill trailing referenced dimension limits
1880+
vnLims(end+1:numel(cRefs)) = 1;
1881+
18761882
% - Catch "reference whole stack" condition
18771883
if (all(vbIsColon))
18781884
vnLinearIndices = 1:prod(vnLims);

0 commit comments

Comments
 (0)