The syntax display(sprintf('...'))
calls two functions and
requires memory allocation. However, the syntax
fprintf('...\n')
requires no memory and allows the code
to execute faster.
Replace display(sprintf('...'))
with
fprintf('...\n')
. You must include the new line character
('\n'
) to maintain behavior.