Path: news.mathworks.com!not-for-mail
From: Tom Bryan <tom.bryan@mathworks.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: reinterpret double as fix point
Date: Fri, 30 Oct 2009 08:43:26 -0400
Organization: The MathWorks, Inc.
Lines: 36
Message-ID: <hcen1e$2ie$1@fred.mathworks.com>
References: <hcej6v$68d$1@fred.mathworks.com>
NNTP-Posting-Host: tbryan-maci.dhcp.mathworks.com
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: fred.mathworks.com 1256906606 2638 144.212.110.200 (30 Oct 2009 12:43:26 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 30 Oct 2009 12:43:26 +0000 (UTC)
User-Agent: Thunderbird 2.0.0.23 (Macintosh/20090812)
In-Reply-To: <hcej6v$68d$1@fred.mathworks.com>
Xref: news.mathworks.com comp.soft-sys.matlab:581261


Hello Stefan,

There is no public interface for the fi object in hand-written mex files.

However, you can compile a MATLAB function into a mex function with fi 
inputs and outputs using emlmex.

If you want to use handwritten mex files, then use builtin integer 
inputs and outputs, and cast to and from fi objects outside of the mex 
function.

Let me know if you need more details.

Best wishes,
Tom Bryan
tom.bryan@mathworks.com

Stefan Jakobs wrote:
> Hello,
> 
> I'm converting a double value to a fix point value and then pass that value to a mex file. The return type of the mex file is double, but the actual value is of type fix point.
> So, how can I make matlab to recognise the double value as a fix point value?
> 
> example (fix_point is the mex file):
> 
> a = fix_point(fi(-1.5, true, 4, 2))
> class(a)
>       ans = double
> a
>       ans =  2.1220e-314
> 
> But that is the wrong value, because 'a' should be interpreted as type fi.
> 
> Thanks for your help.
> Greetings
> Stefan