%% Build C MEX File
% Build a single C program |yprime.c| into a MEX file. 
%% 
% Create a writable folder on your path |c:\work| and set it as the current
% folder.
[s,msg,msgid] = mkdir('c:\work');
if (isempty(msgid))
    mkdir('c:\work')
end
cd c:\work
%% 
% Copy the source code example from the |_matlabroot_/extern/examples|
% folder.
copyfile(fullfile(matlabroot,'extern','examples','mex','yprime.c'),'.','f')
%% 
% Build the MEX file. The output displays information specific to your compiler.
mex yprime.c
%% 
% Test.
T=1;
Y=1:4;
yprime(T,Y)

%% 
% Copyright 2012 The MathWorks, Inc.