MATLAB Answers

If I have to perform arithmetic encoding on a sequence such as "222101" where one of the digits is 0 , how do I solve the error "The symbol sequence parameter must be a vector of positive finite integers"?

4 views (last 30 days)
I am using the function arithenco(seq, counts) and no error is observed if the sequence is made "222131". But I need the message to be specifically "222101". What change in code required to get rid of the error?

  0 Comments

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 2 Jul 2020
In R2020a, you need to edit line 173 of arithenco to change
if ~all(seq > 0) || ~all(isfinite(seq)) || ~isequal(seq, round(seq)) || ...
to be >= 0 instead of > 0
and you need to change line 67
symbol = seq(k);
to
symbol = seq(k) + 1;
I might have missed some changes.
I would suggest to you that it would be far more robust to simply add 1 to all elements of your sequence,
[2 2 2 1 0 1] + 1

  0 Comments

Sign in to comment.

More Answers (0)


Translated by