Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Name of m-file currently being edited (not run)

Subject: Name of m-file currently being edited (not run)

From: ImageAnalyst

Date: 16 Oct, 2009 16:07:50

Message: 1 of 3

Does anyone know how to detect what the filename of the m-file that
currently has focus in the editor? (It's not mfilename - that's only
the name of the currently RUNNING file.) What I would like to do is
to have a shortcut button on my toolbar that changes to the folder
containing this m-file when I click on that shortcut button. I think
this would be easier than to find the folder in the history drop down
list of 20 different Current Folders, and way easier than having to
browse to the folder via the "..." button. I could be wrong, but I
bet it's not a standard thing and it will probably have to be a Yair
Altman undocumented hack (http://undocumentedmatlab.com/#)

Currently, if I have 10 different m-files open in the editor and I
click on one, then I need to do the extra step of changing the current
folder to the folder containing that file. I'd like to simplify that
step.

Subject: Name of m-file currently being edited (not run)

From: Yair Altman

Date: 19 Oct, 2009 18:09:02

Message: 2 of 3

ImageAnalyst <imageanalyst@mailinator.com> wrote in message <a07292bf-2896-4c96-9127-5af7788c524f@g19g2000yqo.googlegroups.com>...
> Does anyone know how to detect what the filename of the m-file that
> currently has focus in the editor? (It's not mfilename - that's only
> the name of the currently RUNNING file.) What I would like to do is
> to have a shortcut button on my toolbar that changes to the folder
> containing this m-file when I click on that shortcut button. I think
> this would be easier than to find the folder in the history drop down
> list of 20 different Current Folders, and way easier than having to
> browse to the folder via the "..." button. I could be wrong, but I
> bet it's not a standard thing and it will probably have to be a Yair
> Altman undocumented hack (http://undocumentedmatlab.com/#)
>
> Currently, if I have 10 different m-files open in the editor and I
> click on one, then I need to do the extra step of changing the current
> folder to the folder containing that file. I'd like to simplify that
> step.

Of course: http://undocumentedmatlab.com/blog/accessing-the-matlab-editor/

You might also consider assigning a keyboard shortcut to this action, using my EditorMacro utility: http://undocumentedmatlab.com/?s=EditorMacro

Yair Altman
http://UndocumentedMatlab.com
 

Subject: Name of m-file currently being edited (not run)

From: Alessandro Russo

Date: 8 Nov, 2013 12:01:16

Message: 3 of 3

matlab.desktop.editor.getActiveFilename

wil do the job.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us