MATLAB: Matlabfunction generates redundant copies of variables
functionmatlabfunctionoptimizerepeatslowsymbolicSymbolic Math Toolboxvariables
Related Question
- How do you find and replace rows in two tables with some variables in common
- Symsum is slow
- Do “datenum” and “datestr” not give the same date after conversion
- Undefined function or variable k symsum
- I cannot modify the ‘FaceAlpha’ property of the ‘Rectangle’ object
- Can I use ‘fplot’ with symbolic bounds
- Am I not getting the correct Laplace Transform of a Heaviside step function
- How do you order table columns based on a vector with their names
Best Answer
The reason why it is slow and creating all those variables is because 'Optimize' is set to true by default. This analysis can be very costly so setting 'Optimize' to false will resolve this issue.
Please note that while having Optimize set to true does create redundant variables, the duplication should not affect the performance of the generated C++ code.