Skip to content

Instantly share code, notes, and snippets.

View twadleigh's full-sized avatar

Tracy Wadleigh twadleigh

View GitHub Profile
@twadleigh
twadleigh / mexjulia.c
Last active August 29, 2015 14:10
Julia as a matlab mex function
#include <julia.h>
#include <mex.h>
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
jl_function_t *mex_main;
jl_value_t *array_type;
jl_array_t *mxout;
jl_array_t *mxin;
# init file with test data: bytes of 0, 1, 2, ..
fn = "tmp.dat"
open(fn, "w") do s
write(s, UInt8[i-1 for i in 1:256])
end
import Base.read
# define an immutable type and a read
immutable A