converting std::vector type to mwArray

조회 수: 2 (최근 30일)
hnde
hnde 2011년 2월 10일
Hello,
I am trying to pass a vector in C++ to a C++ share library matlab function compiled by Matlab Compiler.
I am trying to convert a vector, for example myvect, to the mwArray type so that by matlab function can use it. The myvect has the following format in C++,
vector<double> myvect;
How can I convert this into mwArray type?
Thank you.

채택된 답변

Kaustubha Govind
Kaustubha Govind 2011년 2월 10일
mwArray a(1, myvect.size(), mxDOUBLE_CLASS);
a.SetData(&myvect[0], myvect.size());
  댓글 수: 1
hnde
hnde 2011년 2월 10일
Thank you very much for your answer. It has helped me a lot.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Deploy to C++ Applications Using mwArray API (C++03)에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by