mf = memoize(fh)
| Parameter | Description |
|---|---|
| fh | function handle to memoize. |
| Parameter | Description |
|---|---|
| mf | MemoizedFunction object that caches the results of fh. |
memoize returns a MemoizedFunction that caches the outputs of the function handle fh. Calling the returned object with a set of inputs evaluates fh once for those inputs and returns the cached result on later calls with the same inputs. Set the Enabled property to false to bypass the cache, and use clearCache to empty it.
mf = memoize(@(x) x .^ 2);
y = mf(4)
| Version | Description |
|---|---|
| 2.0.0 | initial version |