Path: news.mathworks.com!not-for-mail
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$1@fred.mathworks.com>
References: <gskiqh$hie$1@fred.mathworks.com> <gsks2r$247$1@fred.mathworks.com> <gsn4ri$ebi$1@fred.mathworks.com> <gsnsdo$8ml$1@fred.mathworks.com> <gsq251$ogs$1@fred.mathworks.com> <gssi41$igq$1@fred.mathworks.com> <gssjmp$7pg$1@fred.mathworks.com> <gt4771$487$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1240923783 10714 172.30.248.37 (28 Apr 2009 13:03:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 28 Apr 2009 13:03:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1810775
Xref: news.mathworks.com 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 =

     1

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.