From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: arithenco Help
Date: Tue, 28 Apr 2009 13:03:03 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 21
Message-ID: <gt6uq7$aeq$>
References: <gskiqh$hie$> <gsks2r$247$> <gsn4ri$ebi$> <gsnsdo$8ml$> <gsq251$ogs$> <gssi41$igq$> <gssjmp$7pg$> <gt4771$487$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: 1240923783 10714 (28 Apr 2009 13:03:03 GMT)
NNTP-Posting-Date: Tue, 28 Apr 2009 13:03:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1810775
Xref: comp.soft-sys.matlab:535947

Ok. I found a solution to my problem. The first thing I did was edit out the the error checking part of arithenco and arithdeco (copy the files to your working directory for safety. MATLAB will use these copies before the ones in the toolbox). The next step was to convert the signal to a form where it starts at 1 and contains only integers. To do this I divided by min(A) and rounded:

>>B = round(A/min(A));

From there I could procede as normal.

>> counts = histc(B, min(B):1:max(B));
>> code = arithenco(B,counts);

And decoding gives me back the B signal:

>> dseq = arithdeco(code,counts,length(B));
>> isequal(dseq,B)

ans =


Obviously, the manipulation of the A signal to give B can result in data loss so be aware of that when doing this. Also, I so far haven't come across any problems with removing the error checking but that's not to say I won't. 

I hope this helps anyone having similar problems with using arithenco. Just be aware of the above caveats. Thanks to Steven and Roger for their help. I wouldn't have figured it out without yer help.