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

4 Ansichten (letzte 30 Tage)
Xuechu Xu
Xuechu Xu am 4 Jul. 2018
Kommentiert: Xuechu Xu am 9 Jul. 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

Akzeptierte Antwort

Wentao Du
Wentao Du am 9 Jul. 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

Weitere Antworten (0)

Kategorien

Mehr zu MATLAB Coder finden Sie in Help Center und File Exchange

Produkte


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by