Proper Treatment of Symbolically Linked Script in Editor

8 次查看(过去 30 天)
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?

回答(1 个)

Steven Lord
Steven Lord 2020-1-17
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 个评论
John Schaefer
John Schaefer 2020-1-20
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.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Search Path 的更多信息

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by