Hacker News new | ask | show | jobs
by kiriakasis 2711 days ago
I only had short experiences with MATLAB/Octave as a student but found that writing MATLAB/Octave rather than MATLAB or Octave was tricky... (IIRC mostly with differently named library functions)

Is this a nuisance also for you? I would be interest in how do you overcome this (asking for a friend working in image processing in MATLAB)

1 comments

To me, it depends on how toolbox dependent your code is. Octave Forge has a lot of really nice libraries, but their interfaces tend to differ from MATLAB toolboxes, so getting codes to go back and forth can be a pain. In core MATLAB/Octave, most of the code is the same with some minor differences. For example, Octave doesn't care about wrapping a line with ..., but MATLAB does. Honestly, that's the most common issue that I have, but the MATLAB parser finds it and it doesn't normally take me more than a few minutes to fix things.

I recall there being some minor differences in how mex files are written, but I'm looking now and all the routines I typically use are mirrored between the two. I will say that I don't like building mex files using mex command inside of the interpreter. Personally, I find it easier just to use a build system like CMake. Mex files are just dynamically linked libraries that link either to libmx and libmex on the MATLAB side or liboctinterp on the Octave side. They look for name mexFunction on our end. As such, I have a flag in the build file to switch between MATLAB and Octave headers and libraries depending on what platform that I want to build for. Just be sure to separate out the binaries because those aren't really compatible between the two and the licensing between them is different as well.