フィルターのクリア

How to calculate execution time of for loop inside the Math function block?

30 ビュー (過去 30 日間)
Abdul Mannan Dadu
Abdul Mannan Dadu 2016 年 11 月 14 日
コメント済み: Walter Roberson 2016 年 11 月 18 日
for k = 1:16
state=[ 1 0 1 0 1 0 1 0 ;
1 0 1 0 1 0 0 1 ;
1 0 1 0 0 1 1 0 ;
1 0 1 0 0 1 0 1 ;
1 0 0 1 1 0 1 0 ;
1 0 0 1 1 0 0 1 ;
1 0 0 1 0 1 1 0 ;
1 0 0 1 0 1 0 1 ;
0 1 1 0 1 0 1 0 ;
0 1 1 0 1 0 0 1 ;
0 1 1 0 0 1 1 0 ;
0 1 1 0 0 1 0 1 ;
0 1 0 1 1 0 1 0 ;
0 1 0 1 1 0 0 1 ;
0 1 0 1 0 1 1 0 ;
0 1 0 1 0 1 0 1 ];
Si1=state(k,1);
Si3=state(k,3);
Si5=state(k,5);
Si7=state(k,7);
.............
.................
g = abs(irefa-io_p_a) + abs(irefb-io_p_b) + abs(irefc-io_p_c)+lambda_sw*abs(Si7-Si7_prev);
if (g<g_opt)
.............
..........
end
end

回答 (1 件)

Grégory SEABRA
Grégory SEABRA 2016 年 11 月 14 日
Hi,
have you tried using tic & toc functions?
  5 件のコメント
Grégory SEABRA
Grégory SEABRA 2016 年 11 月 18 日
If you use the tic toc fonctions in a math function block, you must output the toc result out of this block, otherwise you won't be able to visualize it as you put ";" after them..
Furthermore, you might not be able to simulate in accelerator or rapid accelerator mode because it generate code from this function...
Walter Roberson
Walter Roberson 2016 年 11 月 18 日
Are you using any accelerator mode other than "normal"? Or are you trying to deploy to a hardware device, and if so then which one?
We need this information in order to be able to figure out the appropriate replacement timing mechanism for your situation. We could tell you to just toss in the coder.extrinsic('tic') and coder.extrinsic('toc') like in the error message, but that will only work for the "normal" and "accellerator" mode and not for rapid accelerator mode and not for deployment to hardware.

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by