Proper Treatment of Symbolically Linked Script in Editor

8 Ansichten (letzte 30 Tage)
John Schaefer
John Schaefer am 17 Jan. 2020
Kommentiert: John Schaefer am 20 Jan. 2020
I have a series of simulations from an external application which all require similar post-processing steps. I use a Linux system, and In order to avoid copy-pasting the same post-processing script around, I've created symbolic links to a single post-processing script from subdirectories where the simulations were run. My directory structure looks something like this:
postFiles/
postProcScript.m
runFiles/
run1/
simResults2Process.txt
post/
postProcScript.m <--- symbolic link to ../../../postFiles/postProcScript.m
run2/
simResults2Process.txt
post/
postProcScript.m <--- symbolic link to ../../../postFiles/postProcScript.m
[...]
runN/
simResults2Process.txt
post/
postProcScript.m <--- symbolic link to ../../../postFiles/postProcScript.m
If the current directory is one of the run/post/ directories, then I can run my symbolically linked postProcScript.m script from the command window. However when I open it in the editor, it does NOT open the symbolic link version, but rather it opens the version in postFiles/. This behavior is undesirable because when I click the run button from the editor or press F5, MATLAB says it can't run the script (in postFiles) because the name shadows the name of the script in the run/post directory.
I have been using Linux symbolic links with MATLAB files for years, and do not remember seeing this behavior in previous versions of MATLAB. I recently started using R2018b -- is there a setting I need to change in the new version which will allow me to edit and run a symbolically-linked script or function?

Antworten (1)

Steven Lord
Steven Lord am 17 Jan. 2020
Why not just add the directory containing the original preprocessing script file to the MATLAB search path? That will make it callable regardless of which directory is the current directory.
  1 Kommentar
John Schaefer
John Schaefer am 20 Jan. 2020
The problem is not whether or not the script is callable. I can still invoke the symbolically-linked script by typing its name on the command window in the run#/post directories.
I am more annoyed/inconvenienced by the fact that when I type 'edit postProcScript.m' from the run#/post directory, MATLAB opens the original file (not the symbolic link) in the editor, so when I click the run button or press F5, the execution fails. Previous versions of MATLAB treated symbolically linked files the same as if the original file was actually in the directory, so this was a non-issue.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Search Path finden Sie in Help Center und File Exchange

Produkte


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by