Making a mex function for a rather complex code
7 views (last 30 days)
I have a code which is very time consumming. Therefore, I thought to use mex function to do the heavy part of calculations using C or C++. I have difficulty to define input types properly as my code has some inputs which are rather complex, for instance one input is a function handle and the other one is a variable sized cell whose elements are function handles. The rest of inputs are easy.
To make things easier I thought to ask my question via a very simple code (attached as main.m) rather than mine (this code does nothing for me but if I understand how to tackle this code I am able to tackle my own code). In this code there is a subrutine called 'Cost' which is the 'heay part'. I would like to make a mex function for this subrutine to speed up the calculations. Please note that this code is not my real code and I just made it for the purpose of learning how to make a mex file out of this code (I know that this code does not solve any scientific problem).
I impatiently look forward to hearing from you soon,
Thanks in advance!