Explanation

MATLAB is unable to analyze code within statements called by eval. This prevents MATLAB from performing any performance optimization and limits the guidance that the editor is able to provide. This makes code less efficient and difficult to debug.

Furthermore, concatenated character vectors within an eval statement are often difficult to read. This makes code less clear and causes issues with sharing and maintaining code.


Suggested Action

To allow MATLAB to perform performance optimization, call the statement directly.

OldNew
str = ([ 'save("a.mat");']);    
eval(str); 
save("a.mat");