还有,我在2楼已经说的,三个程序段执行顺序不一样,变化很大.for→while→sum的顺序,出来的时间是:
use for
Elapsed time is 1.969000 seconds.
use while
Elapsed time is 2.438000 seconds.
use sum
Elapsed time is 0.046000 seconds.
如果是sum→for→while的顺序,出来的时间是
use for
Elapsed time is 0.015000 seconds.
use while
Elapsed time is 0.016000 seconds.
use sum
Elapsed time is 0.047000 seconds.
这两种情况都是把程序存在m文件中执行的,如果你直接全部复制到命令窗中执行的话,就算是
sum→for→while的顺序,时间也很大
use sum
Elapsed time is 0.047000 seconds.
use for
Elapsed time is 1.297000 seconds.
use while
Elapsed time is 3.094000 seconds.
大胆的猜想下楼主大概时间就是这样得到的.不过这应该不准.
把三个程序段扔到三个文件里分别执行得到的答案应该是最准确的:
use sum
Elapsed time is 0.047000 seconds.
use for
Elapsed time is 0.015000 seconds.
use while
Elapsed time is 0.016000 seconds.
虽然我说不出什么道理,但实践了很多次,事实就是如此
OldHandle = findobj( \'Name\', \'悲伤\' ) ;if ~isempty(OldHandle),delete(OldHandle) ;end for Time = \'现在\':\'每一天\':\'永远\',set( gco, \'心情\', \'快乐\');end % 这段代码为你天天快乐而存在