MATLAB: How to find the name of the file that is being edited

editorMATLAB

Hi, I would like to write a Matlab script that performs an operation on the file that is being eddited (file that is displayed now in the editor window). To do so, I need to know the name of the file. I was looking all over the places and didn't find the solution. To be more specific, I looking for a solution like gcf() The reason I'm looking for such a solution is that I would like to do some analysis and processing on the eddited file like: Publish (without the Matlab option), save to… Thank you, Alecs

Best Answer

Or you could use the Editor API. Look for help on matlab.desktop.editor for more information -- it seems like getActiveFilename is what you want.