How do I use "surf" function in C++ with matlab coder?

5 visualizaciones (últimos 30 días)
Xuechu Xu
Xuechu Xu el 4 de Jul. de 2018
Comentada: Xuechu Xu el 9 de Jul. de 2018
Hello, I'm trying to use matlab coder to convert a "surf" function. I generated the .lib files and it can be compiled in Visual Studio, but it won't show any figure during debug, how can I achieve this? Thanks! Following is my code.
matlab code:
if true
function threed_surf (x,y,z)
[XX,YY]=meshgrid(x,y);
surf(XX,YY,z);
end
end
C++ test code:
if true
#include "threed_surf.h"
#include <iostream>
using namespace std;
int main()
{
double x[20] = { 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20 };
double y[20] = { 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20 };
double z[400]= { 0 };
threed_surf(x, y, z);
system("pause");
return 0;
}
end
P.S "if true... end" not in my code, but for the format of the bbs

Respuesta aceptada

Wentao Du
Wentao Du el 9 de Jul. de 2018
Take a look at all functions supported for C/C++ code generation (surf is not one of them): https://www.mathworks.com/help/coder/ug/functions-supported-for-code-generation-categorical-list.html

Más respuestas (0)

Categorías

Más información sobre MATLAB Coder en Help Center y File Exchange.

Productos


Versión

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by