Skip to content

Commit b991b1f

Browse files
committed
[ci] fix broken matlab test
1 parent 614ddc4 commit b991b1f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

savebj.m

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,9 @@
192192
opt.nosubstruct_ = 0;
193193
opt.soaformat = lower(jsonopt('SoAFormat', 'col', opt));
194194
opt.unpackhex = jsonopt('UnpackHex', 1, opt);
195+
opt.type2byte_ = struct('uint8', 1, 'int8', 1, 'int16', 2, 'uint16', 2, ...
196+
'int32', 4, 'uint32', 4, 'int64', 8, 'uint64', 8, ...
197+
'single', 4, 'double', 8, 'logical', 1);
195198

196199
[os, maxelem, systemendian] = computer;
197200
opt.flipendian_ = (systemendian ~= upper(jsonopt('Endian', 'L', opt)));
@@ -650,8 +653,7 @@
650653

651654
if (isrowmajor)
652655
% Interleave: reshape each column and concatenate horizontally
653-
bytesizes = cellfun(@(t) numel(typecast(cast(0, t), 'uint8')), types);
654-
bytesizes(strcmp(types, 'logical')) = 1;
656+
bytesizes = cellfun(@(t) opt.type2byte_.(t), types);
655657
totalbytes = sum(bytesizes) * nrecords;
656658
payload = char(zeros(1, totalbytes));
657659
pos = 1;

0 commit comments

Comments
 (0)