필터 지우기
필터 지우기

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

조회 수: 3 (최근 30일)
Xuechu Xu
Xuechu Xu 2018년 7월 4일
댓글: Xuechu Xu 2018년 7월 9일
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