| Author |
Message |
Xellos
Joined: 06 Jan 2005 Posts: 8
|
06 Feb 2005 22:41 test speed of a m-file? |
|
|
|
|
In what situation, you can get a fast result of running a program once.
Thx.
|
|
| Back to top |
|
 |
nicleo
Joined: 06 Sep 2004 Posts: 717 Helped: 60
|
07 Feb 2005 1:16 test speed of a m-file? |
|
|
|
|
If you would to know how long a m-file is executed, you can do as follows:
TimeStart = cputime; % At the beginning of the m-file
TimeConsumed = cputime-TimeStart; % At the end of the m-file
|
|
| Back to top |
|
 |
brmadhukar
Joined: 21 Jun 2002 Posts: 844 Helped: 29
|
07 Feb 2005 17:07 Re: test speed of a m-file? |
|
|
|
|
Hi,
you need to
1) avoid declaring new variable in a loop.
2) avoid indexing that grows in a loop
3) predefine arrays with zero
4) use LUTs
hope this helps
brmadhukar
|
|
| Back to top |
|
 |
Xellos
Joined: 06 Jan 2005 Posts: 8
|
07 Feb 2005 21:54 test speed of a m-file? |
|
|
|
|
thanks a lot!
Added after 4 hours 40 minutes:
another question please!
how can matlab calculates with uint8 data?
I know it can only tell one uint8 number bigger than another uint8. Can it do the addition with uint8 numbers.
or if compile m-file to a c++ program, will it be faster? if so, how to test the speed of a c program?
thanks for your time!!!
|
|
| Back to top |
|
 |