フィルターのクリア

Problems generating code when func params are mixture of matrix and scalar.

1 回表示 (過去 30 日間)
Troy McClure
Troy McClure 2020 年 5 月 11 日
コメント済み: Ameer Hamza 2020 年 5 月 11 日
I'm trying to generate C code for a function but one of the parameters is an MxN matrix, so I'm not sure how to call the function in the single line the wizard gives me to call it. I tried myfunc([ [1 2] [2 3] ], 1.0 ,1.0, 1.0). It didn't like that, so I tried myfunc([ [1 2] ; [2 3] ], 1.0 ,1.0, 1.0) and then it started complaining one of the other parameters shold be a scalar. Are those not all scalars?

採用された回答

Ameer Hamza
Ameer Hamza 2020 年 5 月 11 日
You do not necessarily write everything in one line. Just write a script (as long as you want) that calls that function and make sure it runs without any error. Then type the name of that script on this line in Code generator GUI. It will automatically infer the size and type of the variables.
  4 件のコメント
Troy McClure
Troy McClure 2020 年 5 月 11 日
Oh, looks like it doesn't. I'm trying to gen the code for a matlab function and figured matlab's own code would compile so didn't test it. I guess I'll have to try getting the matlab code to compile.
Ameer Hamza
Ameer Hamza 2020 年 5 月 11 日
I think it is not possible to generate the code of MATLAB built-in function directly. You will need to call it in your own function to generate the code.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeExecution Speed についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by