Be the first to rate this file! 2 Downloads (last 30 days) File Size: 5.83 KB File ID: #17515
image thumbnail

intbitcopy and uintbitcopy

by James Tursa

 

14 Nov 2007 (Updated 14 Nov 2007)

Exact bit copy of variable into signed int__ or unsigned uint__ of same element size

| Watch this File

File Information
Description

Two c-mex functions are supplied. intbitcopy copies a variable into an integer equivalent of the same data element size using an exact bit copy. E.g., doubles are copied to int64, singles are copied into int32, char is copied into int16, etc. Similar to typecast except the result is based on the data element size rather than fixed by input selection. intbitcopy will handle any number of input arguments as long as there are matching output arguments to store the results. For structures and cells, intbitcopy will convert each individual component or cell, keeping the overall structure of the variable the same (same field names, same cell layout, etc.). For non-convertible types (e.g., vpa, function handles, etc.), intbitcopy will return a deep copy. The 2nd mex function uintbitcopy behaves exactly the same as intbitcopy except it returns unsigned integer types.

MATLAB release MATLAB 7.2 (R2006a)
Other requirements Any C compiler, such as the built in lcc compiler.
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.
Tag Activity for this File
Tag Applied By Date/Time
external interface James Tursa 22 Oct 2008 09:35:07
integer James Tursa 22 Oct 2008 09:35:07
bit James Tursa 22 Oct 2008 09:35:07
copy James Tursa 22 Oct 2008 09:35:07
signed James Tursa 22 Oct 2008 09:35:07
unsigned James Tursa 22 Oct 2008 09:35:07

Contact us at files@mathworks.com