from
Example of loading C DLL and performance comparison
by Vinesh Bhunjun
The example shows how to load a C DLL and also compares it with Matlab files
|
| myscr.m |
%% This script compares the execution times of 3 different approaches
% Approach 1: From a dll
% Approach 2: C-like M file
% Approach 3: Vectorized version M file
%% Load the library from dll
loadlibrary conv.dll conv.h
calllib('conv','myconv')
%% Time call for dll, C-like m file and vectorized m file
clc
disp('Call to C DLL:');
tic; calllib('conv','myconv'); toc
disp('Call to C-like M file:');
tic; myconvm1; toc %Time call to C-like m file
disp('Call to vectorized M file:');
tic; myconvm2; toc %Time call to vectorized version
|
|
Contact us at files@mathworks.com