Download Shareware and Freeware Software for Windows, Linux, Macintosh, PDA

line Home  |  About Us  |  Link To Us  |  FAQ  |  Contact

Serving Software Downloads in 956 Categories, Downloaded 50.390.792 Times

mexme - write MEX files in no time 1.0

  Date Added: July 26, 2013  |  Visits: 280

mexme - write MEX files in no time

Report Broken Link
Printer Friendly Version


Product Homepage
Download (45 downloads)



mexme automates the process of writing MEX files. You give mexme a snippet of C which just does numeric computations, as well a list of arguments, and it generates a valid MEX .c file. New in version 1.1, it writes tedious input and output validation code for you. This way you can write a MEX file without manually coding calls to mx* API functions. It's inspired by SciPy's weave function.Example: translate this piece of (non-vectorizable) .m code that applies a recursive filter into C:function [y] = myrecursivefilter(x,alpha) y = zeros(size(x)); y(1) = x(1)*alpha; for ii = 2:length(x) y(ii) = y(ii-1)*(1-alpha) + x(ii)*alpha; endendStep 1: Write myrecursivefilter.csnip which does the same thing as the m file:y[0] = x[0]*alpha;for(mwSize i = 1; i < x_length; i++) { y[i] = x[i]*alpha + y[i-1]*(1-alpha);}Step 2: Define arguments to your function (in Matlab):inputargs = [InputNum('x'),... InputNum('alpha',true,true,'double','alpha > 0 && alpha < 1)]; %scalar %The last conditionoutputarg = OutputNum('y','x_length,1');Step 3: Generate a fully fledged .c file that can be compiled with mex:cfile = mexme('myrecursivefilter.csnip',inputargs,outputarg)writefile('myfilt.c',cfile);mex myfilt.cx = randn(1e6,1);y = myfilt(x,.1);plot([x,y])cfile =/*#include and #define not shown*/#include "mexmetypecheck.c"void mexFunction( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] ){/*Input output boilerplate*/ if(nlhs != 1 || nrhs != 2) mexErrMsgTxt("Function must be called with 2 arguments and has 1 return values"); const mxArray *x_ptr = prhs[0]; const mwSize x_m = mxGetM(x_ptr); const mwSize x_n = mxGetN(x_ptr); const mwSize x_length = x_m == 1 ? x_n : x_m; const mwSize x_numel = mxGetNumberOfElements(x_ptr); const int x_ndims = mxGetNumberOfDimensions(x_ptr); const mwSize *x_size = mxGetDimensions(x_ptr); const double *x = (double *) mxGetData(x_ptr); const mxArray *alpha_ptr = prhs[1]; if(mxGetNumberOfElements(alpha_ptr) != 1) mexErrMsgTxt("Argument alpha (#2) must be scalar"); const double alpha = (double) mxGetScalar(alpha_ptr); if(!(alpha > 0 && alpha < 1)) mexErrMsgTxt("Argument alpha (#2) did not pass test "alpha > 0 && alpha < 1""); mwSize y_dims[] = {x_length,1}; plhs[0] = mxCreateNumericArray(2,y_dims,mxDOUBLE_CLASS,mxREAL); mxArray **y_ptr = &plhs[0]; double *y = (double *) mxGetData(*y_ptr); /*Actual function*/#include "myfilt.csnip"}For every argument that you define, mexme generates extra "magic" variables. For example, if the variable is x, then in C:x is the datax_m is the size of the first dimensionx_n is the size of the second dimensionx_length is the length of a vectorx_numel is the number of elements in an arrayx_ndims is the numer of dimensionsx_size is equivalent to the Matlab code size(x)x_ptr is a reference to the mxArray that contains the x dataAnd if x is complex, x_r and x_i are the real and imaginary components of the data.mexme currently does not support sparse data or non-numeric types but it does support full numeric arrays of any type (int8, single, double, etc.).

Requirements: No special requirements
Platforms: Matlab
Keyword: Alpha Ptr Dims Double Mexerrmsgtxtquotargument Mxgetdatax Ptr Mxgetdimensionsx Ptr Mxgetnumberofdimensionsx Ptr Prhs Scalarquot Size
Users rating: 0/10

License: Shareware Size: 10 KB
USER REVIEWS
More Reviews or Write Review


MEXME - WRITE MEX FILES IN NO TIME RELATED
Development Tools  -  Demo Area Move 1.0
This demo plots a simple figure and a small rectangle (gray) area. The position of the area can be interactively moved and resized interactively (in a standard "windows" way). When the area is double clicked, the figure is zoomed according the...
10 KB  
Networking  -  Galleria WP 1.2.5
Galleria WP is a image gallery plugin for WordPress2.5 or laters. It is used WordPress 2.5's short code functionality.Features: * Galleria image gallery * Switchable CSS styles * Override default CSS styles * Show EXIF meta data * Automatic...
10 KB  
Development Tools  -  Double Exponentian Calculating Program 1.0
This GUIDE program compute the double exponential Alpha and Beta parameters. The fminsearch function make the main calculate process. the program may be comiled by:mcc -m -B sgl FRYO NUEVO RAYO
30.72 KB  
Development Tools  -  Pulsed to tonal strength parameter (PTR) 1.0
Parameter to dynamically track the pulsed to tonal mean power distribution. This set of scripts and functions show how the pulsed to tonal strength parameter can be calculated.The pulsed to tonal strength parameter/ratio (PTR) can give information...
348.16 KB  
Screen Savers  -  Alpha Poljot Watch 1.0
"Alpha Commando Watch" screensaver from series of Poljot watches. This 23-ruby jewel mechanical chronograph Poljot was produced to honor Russia's crack Alpha Special Forces. They may go through fire and water, jump from planes and climb tall...
1.1 MB  
Libraries  -  Chatbot::Alpha::Tutorial 2.04
Chatbot::Alpha::Tutorial is a beginners guide to Chatbot::Alpha 2.x. INTRODUCTION What is Chatbot::Alpha? Chatbot::Alpha is a Perl module for reading and processing Alpha code. Alpha code is a command-driven response language, primarily used...
30.72 KB  
Libraries  -  Chatbot::Alpha::Syntax 2.04
Chatbot::Alpha::Syntax is a Perl module for syntax checking of Chatbot::Alpha replies. SYNOPSIS use Chatbot::Alpha::Syntax; my $syntax = new Chatbot::Alpha::Syntax; # Set strict syntax. $syntax->syntax (strict); # Changed my mind, use...
30.72 KB  
Libraries  -  Chatbot::Alpha::Sort 2.04
Chatbot::Alpha::Sort is a Perl module for alphabetic sorting of Chatbot::Alpha documents. SYNOPSIS use Chatbot::Alpha::Sort; # Create a new sorter. my $sort = new Chatbot::Alpha::Sort(); # Sort your files. $sort->start ( dir =>...
30.72 KB  
Libraries  -  Chatbot::Alpha 2.04
Chatbot::Alpha provides a simple chatterbot brain. The Alpha brain was developed by AiChaos, Inc. for our chatterbots. The Alpha brains language is line-by-line, command-driven. Alpha is a simplistic brain yet is very powerful for making...
30.72 KB  
Bug Trackers  -  Double Choco LatteBugzero 0.9.5
Double Choco Latte is a GNU Enterprise package that provides basic project management capabilities, time tracking on tasks, call tracking, email notifications, online documents, statistical reports, a report engine, and more features are either...
993.28 KB  
NEW DOWNLOADS IN SCRIPTS, DEVELOPMENT TOOLS
Scripts  -  Freelancer Script 5.05
Main Features: 100% Secured. Email Support (3 Years). FREE Updates (3 Years). Post projects. Featured projects. Private projects. Sealed projects. Edit/delete projects. Select freelancers....
5.49 MB  
Scripts  -  B2B Script 4.20
Main Features: 100% Secured. Email Support (3 Years). FREE Updates (3 Years). Sign-up Account (Registration of account). Lead generation tools (for the sellers). Email verification to...
5.49 MB  
Scripts  -  B2C Script 5.06
Main Features: 100% Secured. Email Support (3 Years). FREE Updates (3 Years). The script comes with totally editable site colors, icons and graphics Multilevel categories allows extensive browsing Admin can change Category ordering or...
5.49 MB  
Scripts  -  Social Networking Script 2.86
Main Features: 100% Secured. Email Support (3 Years). FREE Updates (3 Years). Registration with name, email, password, date of birth etc. User can add multiple school, college, university with start...
5.49 MB  
Scripts  -  Business Networking Script 8.04
Main Features: 100% Secured. Email Support (3 Years). FREE Updates (3 Years). Ajax based interface. Profile creation. Different types of profile. Profile for jobseekers, employers and employed...
5.49 MB  
Development Tools  -  Aml2CHM 3.50
Those who use the popular Aml Pages text editor might be looking out for a way of generating help files from their text and notes. Aml2CHM is a plug-in that was developed to offer people a quick and efficient way of converting Aml Pages documents...
549.99 KB  
Development Tools  -  VMP Viewer 1.0
This is a very rudimentary tool to visualize the VMP files generated by BrainVoyager. Useful to share files with people who do not have BV.
10 KB  
Development Tools  -  Sending reports and timestamped file by emailing 1.0
main executing reference usage:[1] usage_send_mail.mIllustrates email sending with multiple separate files or single timestamped tar file. Attachment failure is properly handled, with continuation of report emailing without the attachment.[2]...
768 KB  
Development Tools  -  IrisMVC 2.0 rc1
IrisMVC is an OOP PHP framework that developers can use as a strong and secure foundation to build on various web applications following the Model-View-Controller (MVC) pattern. It provides the basic functionality developers need, without...
51.2 KB  
Development Tools  -  7-Zip for Script 4.42
7-Zip is a file archiver with a high compression ratio.Features:- High compression ratio in new 7z format with LZMA compression- Supported formats:- Packing / unpacking: 7z, ZIP, GZIP, BZIP2 and TAR- Unpacking only: RAR, CAB, ISO, ARJ, LZH, CHM,...
624.64 KB