MATLAB Answers

Henri
0

Matlab: How to profile inefficient lines of code with running count visualisation?

Asked by Henri
on 20 May 2013

I need to find lines that are executed most. For example, Eclipse has a plugin at least for Java that shows the line counts. Does this kind of plugin or tool exist with Matlab?

P.s. I asked the same question in SO: I don't know yet which place is better for Matlab-style questions -- anyway I will close one when other solved and then redirect -- sorry about cross-posting but this is important thing in profiling.

  0 Comments

Log in to comment.

2 Answers

Answer by David Barry on 20 May 2013
 Accepted Answer

No it's there in 2012a but just hidden away. You will be able to use the commands in the link above.

  2 Comments

I was able to find p=profile('info');p.FunctionTable.ExecutedLines but I cannot find a way to visualise the data-dump, it is pretty hard reading.

I was able to profile the inefficient lines by clicking the blue hyperlinks in the Profile Summary. This was solved by the SO thread mentioned. Anyway thank you for your help!

Log in to comment.


Answer by David Barry on 20 May 2013

You should lookup the MATLAB Profiler. This is easily accessible through the toolbar in 2012b onwards (run and time is one way).

http://www.mathworks.co.uk/help/matlab/ref/profile.html

  1 Comment

Thanks, I got the 2012B now running but I cannot yet find a way to generate the linewise analysis. I did all small working examples there but not seeing any colours.

Log in to comment.


Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!