MATLAB: How to run an entire M-file without adding it to the path, in MATLAB 8.0 (R2012b)

MATLAB

I want to directly run an M-file with several sections that I have opened in the Editor.
I would like the functionality of the "Evaluate entire file" option which was available in previous releases.

Best Answer

The "Evaluate entire file" option is not available in the Toolstrip.
A workaround would be to create a shortcut with the following code :
activeEditor = matlab.desktop.editor.getActive;
eval(activeEditor.Text);
This code creates an object of class matlab.desktop.editor which has the property 'Text' that contains all the text included in the active file of the Editor. By using 'eval(activeEditor,Text)' you are evaluating all the commands included in the file.