Be the first to rate this file! 117 downloads (last 30 days) File Size: 7.03 KB File ID: #17476

typecast C-mex function

by James Tursa

 

10 Nov 2007 (Updated 05 Aug 2009)

Code covered by BSD License  

typecast.c is a mex function intended to mimic the MATLAB intrinsic of the same name

Download Now | Watch this File

File Information
Description

The MATLAB typecast function is only available in later versions of MATLAB. The typecast.c file is a mex file intended to mimic this function. Mainly intended for older versions of MATLAB. Since it uses the exact same name as the actual MATLAB function intentionally, it will clash with the actual function if used on later versions of MATLAB. (If you want to use it for later versions and keep the intrinsic function available, just give the typecast.c and typecast.m files different names, e.g. typecastx.c and typecastx.m.) Note that typecast.c is self-building ... you don't have to know anything about C.

Acknowledgements
This submission has inspired the following:
num2vpi - Converts input exactly into vpi
MATLAB release MATLAB 7.2 (R2006a)
Other requirements Any C compiler, such as the built in lcc compiler. (typecast is self-building ... you don't have to know anything about C)
Zip File Content  
Other Files license.txt,
typecast.ZIP
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Updates
12 Feb 2008

I am adding an m-file so that "help typecast" will work.

03 Aug 2009

Changed algorithm from deep data copy to shared data copy. Thus the C-mex typecast is more efficient than the MATLAB intrinsic typecast. Also added the capability to handle complex inputs.

05 Aug 2009

Fixed a sparse matrix bug.

Tag Activity for this File
Tag Applied By Date/Time
external interface James Tursa 22 Oct 2008 09:34:26
typecast James Tursa 22 Oct 2008 09:34:26
cast James Tursa 22 Oct 2008 09:34:26
mex James Tursa 22 Oct 2008 09:34:26
external code interfacing James Tursa 22 Oct 2008 09:34:26
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com