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

5 ビュー (過去 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
  1 件のコメント
Xuechu Xu
Xuechu Xu 2018 年 7 月 9 日
So it is, thank you

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB Coder についてさらに検索

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by