필터 지우기
필터 지우기

How to get the total simulation time as an output in Matlab

조회 수: 5 (최근 30일)
Pooneh Shah Malekpoor
Pooneh Shah Malekpoor 2022년 11월 10일
댓글: Pooneh Shah Malekpoor 2022년 11월 12일
Hello
I am running a simulation in MatLab which outputs some parameter values as I am using save command. What code can I use to have the total simulation time as the output? as I want to compare the time required to do simulation in Matlab with other softwares.
I know there is tic toc but I want the time to be among my saved parameters not shown on my command window.
  댓글 수: 2
Radhe Saini
Radhe Saini 2022년 11월 10일
You can equate the toc to any variable and use it later to compare.
tic
% Sum random code
t = 0:0.1:1000;
A = 10*sin(10*t);
% end of random code
SimulationTime = toc;
sprintf("The time taken for Simulation is " + num2str(SimulationTime))
ans = "The time taken for Simulation is 0.006691"
You can save the 'SimulationTime' variable for later use.
Hope this helps!

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Time Series에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by