We have created an example that utilizes data stored within
vector< pair<string, double> >
STL types into mwArray cell array types, so that they can be utilized within the MATLAB function as cell arrays.
See the attached code below. Some notes on the example:
1. cellDriverMain.cpp is the main driver application code. It is a console application. Its basic operation is:
a. Initialize the deployed MATLAB component. This should only be done once per run, otherwise memory leaks may occur.
b. Construct the STL vector< pair<string, double> > data.
c. Construct the cell array type mwArray using the STL data. Please note that, as shown in the example, strings must be copied into a char array buffer before they can be set to an mwArray.
d. Call the MATLAB function using the mwArray inputs.
e. Return the output as mwArrays and displays it on the console.
f. Terminate the MATLAB deployed component. As with initialization, this must only be done once on the initialized component per run.
2. cellDiary is the example MATLAB function. It simply takes the input arguments and returns them as output. In the process, it will write logs of the input and output variables. Make sure to change the diary file location to an appropriate location on your machine, instead of the placeholder given, if you intend to compile it.
3. Screenshots of the expected console output and log output are also attached.