[Help] Matlab executes the program very slowly (Slow execution)
Show older comments
I am working on code on matlab which basically consist of for loops and matrices values i.e. image processing but it takes around 2 3 minutes to execute the code while the same code runs faster on my other laptop, please help
5 Comments
Philip Borghesani
on 21 Mar 2017
Are you using the same version of matlab on the same os? What processors do the machines have? Post some example code or tell us what code is taking the time by using the profiler. Looping over images by pixel is slow, see if you can vectorize the code to loop over columns at a minimum.
akash bais
on 21 Mar 2017
akash bais
on 21 Mar 2017
Adam
on 21 Mar 2017
That definitely looks suspiciously like for loops. The fact that almost no function is registering at all as significant apart from 'trial' for which 'Self Time' is basically the entire time of the program suggests that you are doing something extremely slow with code that has nothing to do with functions of any other kind.
akash bais
on 21 Mar 2017
Answers (1)
Please try profiler
11 Comments
akash bais
on 21 Mar 2017
akash bais
on 21 Mar 2017
Jan
on 21 Mar 2017
@Chocolate: If you inlcude links in < and > it is clickable.
@akash: Please follow the link of Chocolate, because it is the documentation of the needed command. Everything you need is explained there.
Even better, just
doc profile
should give you your local help. I'm not aware of major changes in the profiler in recent versions, but if you aren't running the latest Matlab you are better looking at your local help than the latest help which may not be valid for your version.
Unless for some reason you don't have local help installed.
akash bais
on 21 Mar 2017
akash bais
on 21 Mar 2017
Jan
on 21 Mar 2017
The main work is done inside the function "trial". No click on this underlines link and examine, which lines takes the most time.
akash bais
on 21 Mar 2017
akash bais
on 22 Mar 2017
Adam
on 22 Mar 2017
We still can't help in any way if we have no more information than that something inside 'trail' is very slow.
Categories
Find more on Introduction to Installation and Licensing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
