I'm trying to take some C++ code and place the appropriate MatLab mex function wrappers around it so that I can call my C++ as a MatLab function. My C++ code takes in 4 command line arguments using argc and argv.
The C++ function call from the command line would be: myfunciton string1 string2 string3 string4
What I want is my MatLab function call from the MatLab command line to look like: myfunction('string1', 'string2', 'string3', 'string4')
I've looked over the following blog post and the OP is able to do this using c (not c++) and between that and the MatLab documentation for C++ I've been a little confused (mostly attributed to differences in Syntax between the Blog Post and Mathwork docs for c++)
https://www.mathworks.com/help/matlab/matlab_external/c-mex-source-file.html
#include "mex.hpp"
#include "mexAdapter.hpp"
using namespace matlab::data;
using matlab::mex::ArgumentList;
class MexFunction : public matlab::mex::Function {
public:
void operator()(ArgumentList outputs, ArgumentList inputs) {
int argc = 0;
argc = inputs.size();
//I'm unsure of how to handle the argv portion(?)
main(argc,argv);
}
int main(int argc, char *argv[]){
//Rest of code... omitted for brevity of question
}
};