I have an executable function that I compiled which takes an input and spits out some outputs when I run it in a terminal. The function is written in C++, and I know that its supposed to be much faster than matlab. But what if my matlab code is using this external function like it’s own, would the fact that its externally called make it slower in any way?
I’m trying to debate if there is any point in me writing a matlab version of this function, when I could just execute it with system() in matlab.
It depends… You have to try it and test the performance.
A better approach would be to write your code as a MEX-function. This gives you the best of both worlds (think of MEX-files as DLL’s): C code performance, with a lower overhead to call than an external process.
Since you already implemented your program in C\C++, you should be able to wrap as MEX-function with little effort..