Matlab editor doubt - edit running code

4 visualizzazioni (ultimi 30 giorni)
Harish Guruprasad
Harish Guruprasad il 10 Mag 2011
Risposto: Jared MacDonald il 3 Mar 2020
Hi all, I have a very silly issue with Matlab. I often run codes which go on for a couple of hours. I like to edit other codes during that time. So when I want to edit a code that is in the current directory, but not in the set of files currently open in the editor,it doesn't open immediately. It only opens after the currently running program is finished.(I am really dependent on the matlab error and warning pointers, so I don't like editing on other editors)
Does the latest version of matlab solve this difficulty?(I use Matlab R2010a). If not, how do I put this in a wish list for the developers to see?
Thanks,
Harish.
  1 Commento
Oliver Woodford
Oliver Woodford il 29 Feb 2020
The title of this question should be: "How to open a file in the editor, while code is running?"

Accedi per commentare.

Risposte (5)

RoJo
RoJo il 10 Mag 2011
If you have access to a MATLAB Builder you can compile the long-running code and run them outside of MATLAB. There is no danger then with changing m files as they run (which is possibly why it is blocked via the workspace). Even on a computer with no MATLAB they run. http://www.mathworks.com/products/matlabxl/ It assumes though that you have a license.

Denis Zhegalin
Denis Zhegalin il 10 Mag 2011
You may open another instance of MATLAB for editing. But you will loose some RAM in this case.
  1 Commento
RoJo
RoJo il 10 Mag 2011
thats true, but I'm wondering if it is good practice to edit m-files in the same path as a running programme (something I would like to know, not pointing out). It is interpreted at run-time, so if any file which is running is changed, I am not sure if that change would be guaranteed not to be picked up in running code.

Accedi per commentare.


Sean de Wolski
Sean de Wolski il 10 Mag 2011
I just keep all relevant m-files open in the editor all of the time...
For when you don't have one you need open:
  • open new m-file while running, copy in old function (after opening it in text editor), save it as that name, EDIT AWAY!

Oliver Woodford
Oliver Woodford il 29 Feb 2020
In more recent versions of MATLAB, if you drag a file from a folder into the editor window, that file will open immediately, even when code is running. I'm not sure since what release this has been the case, but I've known about it for a while.
It's a real shame that right clicking on a function name in the editor, and selecting "Open ..." doesn't work immediately when code is running also, but waits until the code has finished. It's much more of a pain to have to find the file in a file browser window. This seems like an easy thing to fix.

Jared MacDonald
Jared MacDonald il 3 Mar 2020
Hi Harish,
We have heard this pain from others and will fix this in an upcoming release. The short reason is that the action of opening a file flows through MATLAB (through the "open" and "edit" commands) regardless of how you do it, and so, when MATLAB is busy, those operations wait.
In the meantime, the workaround mentioned by Oliver (drag and drop) works to open a file when MATLAB is busy.
Jared

Categorie

Scopri di più su Environment and Settings in Help Center e File Exchange

Tag

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by