I would like to call some custom Matlab
functions in julia which are defined in separate .m
file.
As MVP, consider the file Cps.m
which contains the following code
function C = Cps(T)
% solid maltodextrin
% from Jakob Slots master thesis pp. 87
C = (1548.8+1.9625.*(T-273.15)-5.9399e-3*(T-273.15).^2)*1e-3;%1000;%0*2e3 + 4e3*0;
end
Is there a way to import these functions into julia with Matlab.jl
such that I can call the matlab function
as
mat"""
$res = Cps($input)
"""
or in a similar way?
Never tried to interop with MATLAB, but I’m pretty sure you can find some example here: https://github.com/JuliaInterop/MATLAB.jl
Hope this help!
1 Like
I have also never tried this but my guess is that as long as the Cps.m file is on Matlab’s path then you should be able to do exactly what said. The docs say that
mat"""
"""
just executes arbitrary Matlab code. I would take that to mean if you typed it into the Matlab command window it would work.
1 Like
Thanks, I did not consider that the functions are already accessible if the path to the folder containing the function is already in the search path, so I can do the following.
mat"""
addpath($functionpath)
Cps(1.3)
"""
1 Like