converting std::vector type to mwArray

1 回表示 (過去 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 Center および File ExchangeDeploy 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