comparison matlabFunctionSizePreserving.m @ 696:7c16b5af8d98 feature/quantumTriangles

Add Jonatans symbolic lifehax
author Ylva Rydin <ylva.rydin@telia.com>
date Thu, 05 Oct 2017 18:04:23 +0200
parents
children
comparison
equal deleted inserted replaced
695:ba0d31ce4121 696:7c16b5af8d98
1 % Takes a symfun and makes a better anonymous function
2 function fun = matlabFunctionSizePreserving(f)
3 mf = matlabFunction(f);
4 args = argnames(f);
5
6 funStr = func2str(mf);
7 for i = 1:length(args)
8 funStr = [funStr sprintf(' + 0*%s', toString(args(i)))];
9 end
10
11 fun = str2func(funStr);
12 end