fid = fopen('sevenbytes.bin');
assert(fid >= 0);

[a, cnt] = fread(fid, 3, 'int16');  % should read enough
if (numel(a) ~= 3)
    fprintf('Failed reading 3 16-bit ints\n');
elseif (cnt ~= 3)
    fprintf('Expected cnt==3, got %d\n', cnt);
end

[b, cnt] = fread(fid, 2, 'int16');  % don't have enough data
fprintf('numel(b): %d\n', numel(b));
fprintf('cnt: %d\n', cnt);

fclose(fid);
