4.0

4.0 | 1 rating Rate this file 7 Downloads (last 30 days) File Size: 1.64 KB File ID: #6592

C-MEX file example for 'float' data types

by Ali Behboodian

 

22 Dec 2004 (Updated 29 Dec 2004)

Calling a C file from MATLAB, the C function (a high pass filter) has four arguments ...

| Watch this File

File Information
Description

If you have a C function with arguments that are float or pointer to float (rather than double or pointer to double) you can call the function from MATLAB and pass arguments to the function as single data types. For example, in this case we have a C file that is a highpass filter. In MATLAB ver. 7 we pass arguments to the function as:

[out,mem]=hpinput(single(n),single(mem));

Note that mem is used both as input to the function and output to the function.

If the arguments to the C function were of type double or poiter to double, there was no need to use 'signle' type casting when we were calling the function in MATLAB.

To use this function in MATLAB you need to create a dll file by typing the following command in MATLAB:

mex hpinput.c

The C function is part of the publicly available code for the ILBC coder.

MATLAB release MATLAB 7.0.1 (R14SP1)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (1)
05 Jan 2006 Alex Su  
Please login to add a comment or rating.
Updates
29 Dec 2004

a simple typo

Tag Activity for this File
Tag Applied By Date/Time
external interface Ali Behboodian 22 Oct 2008 07:38:39
mex Ali Behboodian 22 Oct 2008 07:38:39
float Ali Behboodian 22 Oct 2008 07:38:39
utilities Ali Behboodian 22 Oct 2008 07:38:39
single Ali Behboodian 22 Oct 2008 07:38:39
c Ali Behboodian 22 Oct 2008 07:38:39
c Leon Su 12 Jun 2011 03:16:14

Contact us at files@mathworks.com