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

3 次查看(过去 30 天)
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

采纳的回答

Wentao Du
Wentao Du 2018-7-9
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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB Coder 的更多信息

产品


版本

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by