In order to run your C codes, the program should include mex.h header. So please make sure before running.
To start with you enter
mex -setup
the matlab display the following..
Welcome to mex -setup. This utility will help you set up
a default compiler. For a list of supported compilers, see
http://www.mathworks.com/support/compilers/R2013a/win64.html
a default compiler. For a list of supported compilers, see
http://www.mathworks.com/support/compilers/R2013a/win64.html
Please choose your compiler for building MEX-files:
Would you like mex to locate installed compilers [y]/n?
and just type ‘y’ and it display all the available compiler, but if you couldnt find any, you should install some compatible compilers. I have already installed SDK 7.1 which is compatible with MATLAB 2013
Select a compiler:
[1] Microsoft Software Development Kit (SDK) 7.1 in C:\Program Files (x86)\Microsoft Visual Studio 10.0
[1] Microsoft Software Development Kit (SDK) 7.1 in C:\Program Files (x86)\Microsoft Visual Studio 10.0
[0] None
Choose 1 and its all done
To compile keep the .c file in the current folder and enter
mex filename.c
This creates a filename.mexw64 and from now u can run the c files in matlab in the same way as other * .m file
Cheers..!!
Comments
Post a Comment