[Note also the https://lakras.github.io/matlab-to-julia/ translator that was helpful (but not complete) for me for my first professional Julia project (migrating from MATLAB). Getting oct2py to work at the time would have helped, while I just called/used MATLAB (Octave wouldnât have fully worked because of Toolbox code, I had to find substitutes for).]
I could (indirectly) call Octave from Julia, using oct2py, but not even, at first, directly from Python (or R).
julia> using PyCall
julia> o = pyimport("oct2py").Oct2Py();
julia> A = o.hw(1) # or as strict as Julia would have been about types: o.hw([1 2; 3 4]);
Hello world!
2Ă2 Array{Float64,2}:
2.0 3.0
4.0 5.0
shell> less hw.m
function result = hw(A)
disp("Hello world!");
result = A + [1 2; 3 4];
end
Be sure to first to set-up PyCall.jl and:
$ sudo apt-get install octave
$ pip3 install oct2py
DO NOT use the octave snap (maybe itâs 32-bit, as the julia snap, that I also had a problem with, when using with e.g. PyCall, for that reason, conflicting with 64-bit Python), then I couldnât even call Octave from Python, and note pip3
unlike using pip
as documented, as PyCall uses Python3 by default.
Since Julia and Octave (and R) are row-major, but Python is column-major [EDIT: other way around, either would have been a potential problem], I wasnât sure if this was as fast as calling R to call Octave, but I got errors trying that way (more trouble than it was worth to me):
julia> R"""install.packages("RcppOctave")"""
â Warning: RCall.jl: Installing package into â/home/pharaldsson_sym/R/x86_64-pc-linux-gnu-library/3.6â
â (as âlibâ is unspecified)
â Warning: package âRcppOctaveâ is not available (for R version 3.6.3)
â @ RCall ~/.julia/packages/RCall/g7dhB/src/io.jl:113
and even with finding package in archive (there seems to be a reason it was moved there, but using it could work for you, at least with older version of R installed?):
$ R CMD INSTALL ../Downloads/RcppOctave_0.18.1.tar.gz
* installing to library â/home/pharaldsson_sym/R/x86_64-pc-linux-gnu-library/3.6â
ERROR: dependency âpkgmakerâ is not available for package âRcppOctaveâ
* removing â/home/pharaldsson_sym/R/x86_64-pc-linux-gnu-library/3.6/RcppOctaveâ
One other option I didnât look into, itâs possible to call Octave from Sage, and I saw:
https://ask.sagemath.org/question/32324/how-to-add-julia-sage-notebook/
Julia is not shipped with SageMath, but it is installed on SageMathCloud at http://cloud.sagemath.com.