필터 지우기
필터 지우기

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

조회 수: 29 (최근 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 CenterFile Exchange에서 Modeling에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by