converting std::vector type to mwArray

3 visualizaciones (últimos 30 días)
hnde
hnde el 10 de Feb. de 2011
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.

Respuesta aceptada

Kaustubha Govind
Kaustubha Govind el 10 de Feb. de 2011
mwArray a(1, myvect.size(), mxDOUBLE_CLASS);
a.SetData(&myvect[0], myvect.size());
  1 comentario
hnde
hnde el 10 de Feb. de 2011
Thank you very much for your answer. It has helped me a lot.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Deploy to C++ Applications Using mwArray API (C++03) en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by