Skip to content

Instantly share code, notes, and snippets.

@tobbe11
Last active January 3, 2017 07:08
Show Gist options
  • Save tobbe11/af39e09ff7f13b1a0563f233250f74fb to your computer and use it in GitHub Desktop.
Save tobbe11/af39e09ff7f13b1a0563f233250f74fb to your computer and use it in GitHub Desktop.
Matlab
#include "mex.h"
void
mexFunction (int nlhs, mxArray *plhs[],
int nrhs, const mxArray *prhs[])
{
mexPrintf ("Hello, World!\n");
mexPrintf ("I have %d inputs and %d outputs\n", nrhs, nlhs);
}

Functions at command line

sqr = @(x,y) x.^2+y.^2; % Anonymous function, f = @(arglist)expression 
arrayfun(sqr, [3 4],[4 4]) or arrayfun(@(x) x^2, [2 3 4])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment