Trouble understanding the Code Generation Advisor Messages
5 ビュー (過去 30 日間)
古いコメントを表示
My understanding about SIMULINK advisor
SIMULINK advisor is there so that modellers do not make silly mistakes that could cause an error in code generation and rapid prototyping. The target is to pass all the models without any warnings so that the code generation activity is smooth.
My problem
I have a model that is currently encountering only one warning message in the code generation advisor. The category is Identify blocks using one-based indexing. I understand what 1 (MATLAB) and 0 (usually in C, Java, etc.) based indexing are. But I am failing to understand why this is popping up all the time. I assume that because my TL is C and C uses 0 based indexing, Code Generation Advisor is suggesting that I check for 1-based indexing. I cannot seem to find out what is wrong.
The problem is coming from a MATLAB func block that I am using in SIMULINK model. Due to confidentiality reason, I cannot put the actual content of the file, but can alter the text and provide a technically identical version of the function that is being reported to have "1-based indexing" issue in the advisor dashboard.
function y = IDENT_TABLE(ID_1_INTERNAL, ID_2_INTERNAL, ID_3_INTERNAL)
if ID_3_INTERNAL == 1
y = 1;
else
y = 0;
end
I would really appreciate an explanation :)
Thanks in advance,
0 件のコメント
採用された回答
Bhavani
2013 年 7 月 23 日
The 'Identify blocks using one-based indexing' check recommends using zero-based indexing for all blocks in your model to increase execution efficiency of the generated code. In this case, the MATLAB Function block requires one-based indexing, so you cannot configure it to use zero-based indexing. You can consider replacing the MATLAB Function block with Simulink basic blocks using zero-based indexing, if that is possible.
If you need to use a MATLAB Function block, and are using R2012a or later release of MATLAB, you can consider excluding this block from this check during analysis, so that the check will not flag this block. This is however only available when running the check through the Model Advisor, and is not currently available through the Code Generation Advisor. See http://www.mathworks.com/help/slvnv/ug/excluding-blocks-from-model-advisor-checks.html for more information on exclusions.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Run Model Advisor Checks についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!