Mercury
Mercury

Reputation: 1965

closing specific file from Matlab editor

Is there's any command line interface to close a single file from all the open files? I know I can close all files yet I sometimes work from a network location and I would like to close a set of files with a single script.

Upvotes: 0

Views: 292

Answers (1)

Jetpac
Jetpac

Reputation: 2125

For recent MATLABs you can close files that are open in the MATLAB editor with something like the following:

matlab.desktop.editor.findOpenDocument( 'C:\my_function.m' ).close()

For older MATLABs you can try something like this (but I don't have an old installation to test):

com.mathworks.mlservices.MLEditorServices.closeDocument( 'C:\my_function.m' )

Upvotes: 3

Related Questions