필터 지우기
필터 지우기

Where can I see how much time it takes to simulate a .m file?

조회 수: 4 (최근 30일)
P
P 2011년 6월 13일
Hy I have matlab 2010 and I want to see how much time spends my program to calculate my answer.

채택된 답변

Arnaud Miege
Arnaud Miege 2011년 6월 13일
Use tic and toc.
HTH,
Arnaud
  댓글 수: 1
Yella
Yella 2011년 6월 14일
>> tic
>> x=[0 0 0 0 1 1 1 1]
x =
0 0 0 0 1 1 1 1
>> toc
Elapsed time is 13.588797 seconds.
>> toc
Elapsed time is 19.517226 seconds.
>> toc
Elapsed time is 22.023382 seconds.
>> toc
Elapsed time is 24.155255 seconds.
>> toc
Elapsed time is 26.709085 seconds.
>> toc
Elapsed time is 28.744743 seconds.
>> toc
Elapsed time is 38.494105 seconds.
>> toc
Elapsed time is 47.280638 seconds.
>> toc
Elapsed time is 71.253025 seconds.
>> x=[0 1 1 1]
x =
0 1 1 1
>> toc
Elapsed time is 89.445975 seconds.
tic and toc also add up the time taken to type the code on comman window
tic toc works good for .m files

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

추가 답변 (2개)

Kaustubha Govind
Kaustubha Govind 2011년 6월 13일
You can also use MATLAB Profiler.

siddhu
siddhu 2011년 6월 14일
Hi, I have one more way to do it.Add tic at start part of the code and toc at the end part of the code in .m file . tic-toc are used to display how much time the .mfile is taking for simulation.
  댓글 수: 1
P
P 2011년 6월 14일
Thx a lot siddhu, I will also try this and I will compare the results

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

카테고리

Help CenterFile Exchange에서 Performance and Memory에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by