tdalon
9/6/2016 - 12:46 PM

Get current file opened in MATLAB Editor

Get current file opened in MATLAB Editor

function file=EditorGetFile
% EditorGetFile get current file opened in Editor
%
% SYNTAX:
%    file=EditorGetFile
% OUTPUT:
%    file (char): fullpath

edhandle = com.mathworks.mlservices.MLEditorServices.getEditorApplication;
file = edhandle.getActiveEditor.getDocument.getFilename;
file = char(file);