You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using mexjulia to call a julia function "compute_LL.jl" from matlab which takes a dict as an input. I'm passing it a Matlab struct, which gets converted sensibly to a dict but its fields, which are just arrays of doubles and logicals, get converted into MxArrays.MxArray which somehow no methods seem to be defined for. I think this type should inherit all the functionality of MATLAB.MxArray types but basic methods which are defined for those (I've tried length, subscript indexing) throw an "undefined method" error. I'm using Julia 0.6 and Matlab R2017a on a PC running Windows 10. I'm attaching the Julia module "DriftDiffusison" which contains the function compute_LL which I am calling.
When I call this function, I get: "MethodError: no method matching length(::MxArrays.MxArray)" on line 29 of the module.
The struct getting passed to this function looks like:
OK, I'm still new to Julia but I think I have a better understanding of the problem now, and it is (I think) rather simpler than I thought. The problem is just that, currently, there is no functionality in mexjulia for dealing with composite types. IOW, a cell array in Matlab like { [5 6] [7 8] } gets sensibly converted to a julia array, but its elements don't get converted to julia types. They just end up as MxArrays.MxArray types, which Julia doesn't know how to deal with. Structured arrays also end up as MxArrays.MxArray types in Julia, causing problems. It seems like adding this functionality wouldn't be too hard -- mexjulia would just have to call jvalue recursively, each time checking its output to see if it needs to be run again.
That's a shame! Working with proprietary software has definite downsides. Now that I've figured this out, I can scrape by as long as I keep my variables simple.
I'm using mexjulia to call a julia function "compute_LL.jl" from matlab which takes a dict as an input. I'm passing it a Matlab struct, which gets converted sensibly to a dict but its fields, which are just arrays of doubles and logicals, get converted into MxArrays.MxArray which somehow no methods seem to be defined for. I think this type should inherit all the functionality of MATLAB.MxArray types but basic methods which are defined for those (I've tried length, subscript indexing) throw an "undefined method" error. I'm using Julia 0.6 and Matlab R2017a on a PC running Windows 10. I'm attaching the Julia module "DriftDiffusison" which contains the function compute_LL which I am calling.
When I call this function, I get: "MethodError: no method matching length(::MxArrays.MxArray)" on line 29 of the module.
The struct getting passed to this function looks like:
struct with fields:
DriftDiffusion.zip
The text was updated successfully, but these errors were encountered: