MATLAB: Difference between revisions

364 bytes added ,  29 September 2019
no edit summary
(Created page with " =Usage= ===Anonymous Functions=== [https://www.mathworks.com/help/matlab/matlab_prog/anonymous-functions.html Reference] <syntaxhighlight lang="matlab"> sqr = @(x) x.^2; </s...")
 
No edit summary
Line 6: Line 6:
<syntaxhighlight lang="matlab">
<syntaxhighlight lang="matlab">
sqr = @(x) x.^2;
sqr = @(x) x.^2;
</syntaxhighlight>
=== Timing Code ===
[https://www.mathworks.com/help/matlab/matlab_prog/measure-performance-of-your-program.html Reference]
<code>tic</code> starts a timer. <code>toc</code> returns the time elapsed in seconds since the started timer.
<syntaxhighlight lang="matlab">
timerVal = tic
  % The program section to time.
elapsedTime = toc(timerVal)
</syntaxhighlight>
</syntaxhighlight>