File tree Expand file tree Collapse file tree 2 files changed +9
-9
lines changed
Expand file tree Collapse file tree 2 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -24,18 +24,18 @@ Class to define functions in a way that we can track the number of function eval
2424See more examples in ` Examples.mlx ` .
2525
2626``` matlab
27- # define the function
27+ % define the function
2828f = @(x) x^2;
2929
30- # new function handle that counts the number of function evaluations
31- [f,count] = CountedFunction.count_function_calls(f)
30+ % new function handle that counts the number of function evaluations
31+ [f,count] = CountedFunction.count_function_calls(f);
3232
33- # evaluates the function 1000 times
34- for i = 1:1000;
33+ % evaluates the function 1000 times
34+ for i = 1:1000
3535 f(0);
3636end
3737
38- # prints the number of function evaluations
38+ % prints the number of function evaluations
3939count()
4040```
4141
@@ -47,12 +47,12 @@ ans =
4747
4848
4949``` matlab
50- # evaluates the function another 1000 times
51- for i = 1:1000;
50+ % evaluates the function another 1000 times
51+ for i = 1:1000
5252 f(0);
5353end
5454
55- # prints the number of function evaluations again
55+ % prints the number of function evaluations again
5656count()
5757```
5858
You can’t perform that action at this time.
0 commit comments