juliamatlab / mexjulia

embedding Julia in the MATLAB process.
MIT License
52 stars 14 forks source link

Passing matlab functions to julia function #25

Closed musm closed 8 years ago

musm commented 8 years ago

I would like to pass my matlab function to a julia function that takes a function as argument. Is this possible?

twadleigh commented 8 years ago

Yes, with a little extra marshaling work. The lm_test.m example (and accompanying files) show an example of this.

twadleigh commented 8 years ago

In fact, I think it might make sense to add a more generic method for making MxArrays callable that does the default data marshaling, so that treating an MxArray as a function will "just work" in the obvious cases.

twadleigh commented 8 years ago

27 makes this easier. See the (updated) lmdif_test.m for an example of passing a matlab function handle to julia as a callback.

musm commented 8 years ago

thanks for the example.

Now the example doesn't ever finish running on my PC (looks like it froze, but I get no error messages) FYI: I do have Optim and Calculus installed.