Save Variable Matlab, Then, in the Save Workspace Variables dialog box, set the Save as type option to MATLAB Script.