![]() |
![]() |
![]() |
![]() |
ECE Help - General FAQ* My Matlab .m file takes a long time to run. What are the options for speeding it up? - Preallocate all memory as far as possible using the commands 'zeros' or 'ones'. This eliminates the need for Matlab to dynamically allocate more memory for your data structure as it grows in size. For details, visit the URL: http://www.mathworks.com/support/solutions/data/26623.shtml - Consider removing the 'for' loops in your Matlab script/function and 'vectorize' it instead. The Matlab computing engine is designed and optimised for working on matrices/vectors,not for 'for' loops. For tips on how to vectorize your code, see the URL: http://www.mathworks.com/support/tech-notes/1100/1109.shtml * I am facing memory related problem while using Matlab. - Preallocating memory,using 'clear' for removing unwanted data and using Matlab without its Java based GUI are three important ways to avoid 'Out-of-Memory' errors. Matlab R12 and higher have a Java based dektop. It consumes considerable amount of memory that is in addition to the amount needed by the Matlab engine. The 'matlab -nojvm' command launches Matlab without the its Java frontend. For more details: http://www.mathworks.com/support/tech-notes/1100/1106.shtml#avoid_errors * I am planning to run large Matlab programs/simulations on the ECE server. They may run overnight or even for days. What should I do? - Try to vectorize your Matlab code as explained above to minimize computation time. Removing 'for' loops can easily cause a speedup by a factor of 3-5,possibly more! - Launch Matlab without its Java GUI ('matlab -nojvm'), to conserve memory for your own computation and for others. - If you want to log out and go home while the computation runs (Windows or UNIX), consider running Matlab in batch mode. Details at the URL: http://www.mathworks.com/support/solutions/data/1032.shtml |
![]() |
![]() |
![]() |
![]() |







