Description
Currently, we never explicitly clear MATLAB workspace variables before executing a script. This could lead to stale variables interfering with script execution.
I think we should probably never clear variables when running from within MATLAB, as MATLAB is the host environment and ImageJ.
When running from within ImageJ and calling MATLAB remotely, I think we may not want to clear variables if the UI is visible (as the user may want to inspect and modify things manually in this case). If the UI is hidden, I think there is a valid argument for wanting to clear the workspace.
That said, I do think clearing the workspace is putting a burden on the user to design a single script that "does everything" - the expectation being that MATLAB acts like a fully functional language. Until ImageJ-MATLAB can handle both script and function paradigms I think we may just want to accept that there are side-effects.