【发布时间】:2010-05-19 16:11:32
【问题描述】:
我想将字符串向量从 C++ 传递到 MATLAB。我曾尝试使用mxCreateCharMatrixFromStrings 等可用功能,但它并没有给我正确的行为。
所以,我有这样的事情:
void mexFunction(
int nlhs, mxArray *plhs[],
int nrhs, const mxArray *prhs[])
{
vector<string> stringVector;
stringVector.push_back("string 1");
stringVector.push_back("string 2");
//etc...
问题是如何把这个向量放到matlab环境中?
plhs[0] = ???
我的目标是能够跑步:
>> [strings] = MyFunc(...)
>> strings(1) = 'string 1'
【问题讨论】: