フィルターのクリア

How can I select the working dimension by supplying the DIM argument?

12 ビュー (過去 30 日間)
Shubhashree Bal
Shubhashree Bal 2019 年 11 月 7 日
回答済み: Steven Lord 2020 年 10 月 19 日
While generating C code for below code:
a= [1 2 3 4 5];
u = a/max(a);
I am getting error:
The working dimension was selected automatically, is variable-length, and has length 1 at run time. This is not supported. Manually select the working dimension by supplying the DIM argument.
How can I solve this?
  2 件のコメント
John D'Errico
John D'Errico 2019 年 11 月 7 日
Read the help for max. Look at the various ways you can use the max function.
Rutvik Shete
Rutvik Shete 2020 年 10 月 19 日
Use elementwise division. u = a./max(a); "dot" is important.

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

回答 (1 件)

Steven Lord
Steven Lord 2020 年 10 月 19 日
In the Extended Capabilities section of the documentation page for the max function, expand the "C/C++ Code Generation" item. The page linked in the third bullet in that item, "Variable-Sizing Restrictions for Code Generation of Toolbox Functions", offers some explanation and a suggestion for how to resolve the problem.

カテゴリ

Help Center および File ExchangeDeployment Basics についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by